Page 1 of 2

How can i prevent that F10 brings focus to the menubar

Posted: Thu Aug 18, 2011 6:17 am
by Markus Walter
Hello,

in Windows F10 activates the menubar. How can i prevent this using the express GET-System?

Thanks in advance.

Re: How can i prevent that F10 brings focus to the menubar

Posted: Thu Aug 18, 2011 12:23 pm
by sdenjupol148
Hi Markus,

Have you tried using DCHOTKEY?

You could set xbeK_F10 to something like {|| .T. }


Hope it helps

Bobby

Re: How can i prevent that F10 brings focus to the menubar

Posted: Thu Aug 18, 2011 3:59 pm
by rdonnay
This will do it:

Code: Select all

#INCLUDE "dcdialog.ch"
#INCLUDE "appevent.CH"

FUNCTION Main()

LOCAL GetList[0], dDate := Date(), oMenuBar, oMenu

DC_ReadGuiHandler( {|a,b,c,d,e,f,g,h|MyHandler(a,b,c,d,e,f,g,h)} )

DCMENUBAR oMenuBar
 DCSUBMENU oMenu PROMPT 'Menu' PARENT oMenuBar
   DCMENUITEM 'Menu Item' PARENT oMenu

@ 0,0 DCGET dDate

DCREAD GUI

RETURN Nil

* ---------

PROC appsys ; return

* ---------

STATIC FUNCTION MyHandler( nEvent, mp1, mp2, oXbp, oDlg, GetList )

IF nEvent == xbeP_Keyboard .AND. mp1 == xbeK_F10
  RETURN DCGUI_IGNORE
ENDIF

RETURN DCGUI_NONE

Re: How can i prevent that F10 brings focus to the menubar

Posted: Fri Aug 19, 2011 2:04 am
by Markus Walter
SbDrakos wrote:Hi Markus,
Have you tried using DCHOTKEY?
You could set xbeK_F10 to something like {|| .T. }
Hope it helps
Bobby
Hi Bobby,
no, this doesn't help. I want to use F10 as a ACCELKEY, but i want to prevent that the XbpMenuBar receives the focus...

Re: How can i prevent that F10 brings focus to the menubar

Posted: Fri Aug 19, 2011 2:10 am
by Markus Walter
Hi Roger,

this was my first test. This prevents that the XbmMenuBar gets focus, but with this i can't use F10 for anything else (f. e. as a ACCELKEY). But this is want i want to do: I want to use F10 as ACCELKEY, but the XbpMenuBar should't receive the focus. BTW, XbpMenuBar receives focus even if it is disabled...

Any other hint?

Re: How can i prevent that F10 brings focus to the menubar

Posted: Fri Aug 19, 2011 8:56 am
by Koverhage
Markus,

i use this

DCHOTKEY xbeK_F10 ACTION { || perauft(), DC_GetRefresh( GetList ) }

and have no problem.

Re: How can i prevent that F10 brings focus to the menubar

Posted: Sun Aug 21, 2011 11:46 pm
by Markus Walter
Koverhage wrote:Markus,
i use this
DCHOTKEY xbeK_F10 ACTION { || perauft(), DC_GetRefresh( GetList ) }
and have no problem.
No, it is the same problem with DCHOTKEY. The Menubar gets the focus. perauft() is called, but the menubar has the focus, even if it is disabled.

Edit: I don't have MODAL windows. With Modal-Windows it seams to work. But not with my NON-Modal-situation.

Re: How can i prevent that F10 brings focus to the menubar

Posted: Mon Aug 22, 2011 11:56 am
by rdonnay
I don't understand why you are having a problem. This works for me:

Code: Select all

#INCLUDE "dcdialog.ch"
#INCLUDE "appevent.CH"

FUNCTION Main()

LOCAL GetList[0], dDate := Date(), oMenuBar, oMenu

DCMENUBAR oMenuBar
 DCSUBMENU oMenu PROMPT 'Menu' PARENT oMenuBar
   DCMENUITEM 'Menu Item' PARENT oMenu

@ 0,0 DCGET dDate

DCHOTKEY xbeK_F10 ACTION {||msgbox('test')}

DCREAD GUI

RETURN Nil

* ---------

PROC appsys ; return

Re: How can i prevent that F10 brings focus to the menubar

Posted: Mon Aug 22, 2011 11:35 pm
by skiman
[quote="rdonnay"]I don't understand why you are having a problem. This works for me:

Hi Roger,

Yes, this is working, but you will see that the menubar got focus. This is what Markus want to disable. I don't know if this is possible. The focus for the menubar with F10 is standard Windows behaviour.

Re: How can i prevent that F10 brings focus to the menubar

Posted: Tue Aug 23, 2011 12:54 am
by Markus Walter
Hi Chris,
hi Roger,

correct Chris. This is my problem. And because i have a "special" Application-Design (non-modal-windows, but opening a new window disable the parent) the problem is real. The Menubar even gets the focus even though it is disabled...

Edit: I have now a "dirty" workaround: I catch the F10-Event in my custom handler and post another keyboardevent and use this keyboard event as a ACCELKEY. Not nice, but a workaround...