Missing Btnbmp-accelerators inside a window ?

Missing Btnbmp-accelerators inside a window ?

Postby ukoenig » 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: Select all  Expand view

#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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Missing Btnbmp-accelerators inside a window ?

Postby Antonio Linares » 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
User avatar
Antonio Linares
Site Admin
 
Posts: 41366
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Missing Btnbmp-accelerators inside a window ?

Postby ukoenig » Sun May 25, 2014 8: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 :lol:
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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 54 guests