How can i prevent that F10 brings focus to the menubar

This forum is for eXpress++ general support.
Message
Author
User avatar
Markus Walter
Posts: 54
Joined: Thu Jan 28, 2010 12:49 am
Location: Germany

How can i prevent that F10 brings focus to the menubar

#1 Post by Markus Walter »

Hello,

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

Thanks in advance.
-----------------
Greetings
Markus Walter

User avatar
sdenjupol148
Posts: 151
Joined: Thu Jan 28, 2010 10:27 am
Location: NYC

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

#2 Post by sdenjupol148 »

Hi Markus,

Have you tried using DCHOTKEY?

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


Hope it helps

Bobby

User avatar
rdonnay
Site Admin
Posts: 4733
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

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

#3 Post 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
The eXpress train is coming - and it has more cars.

User avatar
Markus Walter
Posts: 54
Joined: Thu Jan 28, 2010 12:49 am
Location: Germany

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

#4 Post 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...
-----------------
Greetings
Markus Walter

User avatar
Markus Walter
Posts: 54
Joined: Thu Jan 28, 2010 12:49 am
Location: Germany

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

#5 Post 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?
-----------------
Greetings
Markus Walter

Koverhage
Posts: 151
Joined: Mon Feb 01, 2010 8:45 am

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

#6 Post by Koverhage »

Markus,

i use this

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

and have no problem.
Klaus

User avatar
Markus Walter
Posts: 54
Joined: Thu Jan 28, 2010 12:49 am
Location: Germany

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

#7 Post 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.
-----------------
Greetings
Markus Walter

User avatar
rdonnay
Site Admin
Posts: 4733
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

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

#8 Post 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
The eXpress train is coming - and it has more cars.

skiman
Posts: 1185
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

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

#9 Post 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.
Best regards,

Chris.
www.aboservice.be

User avatar
Markus Walter
Posts: 54
Joined: Thu Jan 28, 2010 12:49 am
Location: Germany

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

#10 Post 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...
-----------------
Greetings
Markus Walter

Post Reply