FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Missing Btnbmp-accelerators inside a window ?
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Missing Btnbmp-accelerators inside a window ?
Posted: Sat May 24, 2014 11:26 AM
Hello,

I noticed, placing buttons inside a window ( BTNBMP ),
the ACCELERATORS don't work.
Maybe something missing or not possible ?

A little test

Code (fw): Select all Collapse
#include "Fivewin.ch"

FUNCTION MAIN()
LOCAL oWndMain, oBtn1, oFont1

DEFINE FONT oFont1 NAME "Arial" SIZE 0, -12 

DEFINE WINDOW oWndMain FROM 5, 5 TO 400, 600 PIXEL ;
TITLE "Button accelerator" MENU TMenu():New()

// ACCELERATOR DOESN't WORK

@ 50, 130 BTNBMP oBtn1 OF oWndMain ;
SIZE 120, 45 PIXEL 2007 ; 
NOBORDER ;
PROMPT " &Load dialog" ;
ACTION LOAD_DLG(oWndMain, oFont1) ;
FONT oFont1 ;
CENTER

ACTIVATE WINDOW oWndMain 
                   
oFont1:End()

RETURN NIL

// ----------------- ACCELERATOR WORKS -------

FUNCTION LOAD_DLG(oWndMain, oFont1)
LOCAL oDlg, oBtn1

DEFINE DIALOG oDlg SIZE 400, 240 PIXEL

@ 20, 50 BTNBMP oBtn1 OF oDlg ;
SIZE 60, 25 PIXEL 2007 ; 
NOBORDER ;
PROMPT " &Exit dialog" ;
ACTION oDlg:End() ;
FONT oFont1 ;
CENTER

ACTIVATE DIALOG oDlg CENTERED

RETURN NIL


best regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: Missing Btnbmp-accelerators inside a window ?
Posted: Sat May 24, 2014 11:13 PM

Uwe,

By default windows don't trigger such event, only dialog boxes. (unless I am wrong)

You could set a menu with a menuitem whose accelerator matches the one that you are looking for. That could help.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: Missing Btnbmp-accelerators inside a window ?
Posted: Sun May 25, 2014 08:22 AM
Antonio,

As a working solution, I added :

oDlgMain:bKeydown := { |nKey| ;
IIF( nKey = 67, oSBtn[1]:Click(), NIL ), ;// c
IIF( nKey = 85, oSBtn[2]:Click(), NIL ), ;// u
IIF( nKey = 76, oSBtn[3]:Click(), NIL ), ;// l
IIF( nKey = 79, oSBtn[4]:Click(), NIL ), ;// o
...
..
IIF( nKey = 77, oSBtn[15]:Click(), NIL ), ;// m
IIF( nKey = 48, oSBtn[16]:Click(), NIL ), ;// t
IIF( nKey = 82, oSBtn[17]:Click(), NIL ) }// r


Best regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.

Continue the discussion