Page 1 of 1
START DCMENUBAR SHOWING THE FIRST DCSUBMENU
Posted: Sat Aug 21, 2021 11:50 pm
by Diego Euri Almanzar
When using DCMENUBAR, I would like the first submenu (DCSUBMENU) to be visible immediately. It always appears hidden. What can I do to make the first submenu visible?
Best regards.
Re: START DCMENUBAR SHOWING THE FIRST DCSUBMENU
Posted: Sun Aug 22, 2021 3:56 am
by Wolfgang Ciriack
Perhaps you can send an PostAppEvent(xbeP_ItemSelected, , , oMyMenuBar) from the EVAL block of your DCREAD GUI.
Re: START DCMENUBAR SHOWING THE FIRST DCSUBMENU
Posted: Sun Aug 22, 2021 6:15 am
by rdonnay
The Windows Menu System has always been the weakest GUI class of all.
I wrote the below sample program, hoping it would work, only to finally see the last sentence in the docs.
Windows does not support this method.
Sorry, I have no solution for you.
Code: Select all
#INCLUDE "dcdialog.CH"
#INCLUDE "appevent.CH"
FUNCTION Main()
LOCAL GetList[0], oMenuBar, oSubMenu1, oSubMenu2, oSubMenu3
DCMENUBAR oMenuBar
DCSUBMENU oSubMenu1 PROMPT 'SubMenu 1' PARENT oMenuBar
DCMENUITEM 'Menu Item 1' ACTION {||nil} PARENT oSubMenu1
DCMENUITEM 'Menu Item 1' ACTION {||nil} PARENT oSubMenu1
DCSUBMENU oSubMenu2 PROMPT 'SubMenu 2' PARENT oMenuBar
DCMENUITEM 'Menu Item 1' ACTION {||nil} PARENT oSubMenu2
DCMENUITEM 'Menu Item 1' ACTION {||nil} PARENT oSubMenu2
DCSUBMENU oSubMenu3 PROMPT 'SubMenu 3' PARENT oMenuBar
DCMENUITEM 'Menu Item 1' ACTION {||nil} PARENT oSubMenu3
DCMENUITEM 'Menu Item 1' ACTION {||nil} PARENT oSubMenu3
DCREAD GUI EVAL {||oSubMenu2:selectItem(2), ;
PostAppEvent(xbeMENB_BeginMenu,,,oMenuBar)}
RETURN nil
PROC appsys ; RETURN
Re: START DCMENUBAR SHOWING THE FIRST DCSUBMENU
Posted: Tue Aug 24, 2021 7:24 pm
by Diego Euri Almanzar
I have made the suggestions that you have given me, but I cannot activate the first submenu, by automatic means
Since there are no methods for controlling DCMENUBAR, try using dcputkey, but it doesn't work either
DCSUBMENU oFileMenu PROMPT "& File" PARENT oMenuBar
DCMENUITEM "& Open a File" PARENT oFileMenu; ACTION {|| Msgbox ('OpenFile')};
DCMENUITEM "& Close File" PARENT oFileMenu; ACTION {|| Msgbox ('CloseFile')}
DOES NOT ACTIVATE WITH
DCPUSHBUTTON ACTION {|| DC_PUTKEY (K_ALT_F)}
DOES NOT ACTIVATE WITH HANDLERBLOCK
DCREAD GUI PARENT AREADLG HANDLERBLOCK {|| DC_PUTKEY (K_ALT_F)}
NOT ACTIVATED WITH EVAL
DCREAD GUI PARENT AREADLG EVAL {|| DC_PUTKEY (K_ALT_F)}
Can you help me?
Best regards
Re: START DCMENUBAR SHOWING THE FIRST DCSUBMENU
Posted: Wed Aug 25, 2021 1:36 am
by Diego Euri Almanzar
I could already solve the problem.
I already make visible, without user intervention, the first submenu of a menu bar, writing the postappevent statement before the READ GUI
DCMENUBAR oMenuBar
DCSUBMENU oFileMenu PROMPT "&File" PARENT oMenuBar
DCMENUITEM "&Open a File" PARENT oFileMenu ; ACTION {||Msgbox('OpenFile')}
DCMENUITEM "&Close File" PARENT oFileMenu ; ACTION {||Msgbox('CloseFile')}
PostAppEvent( xbeP_Keyboard, XBEK_ALT_F ,, oDLGmain )
DCREAD GUI PARENT oDLGmain
Best regards
Re: START DCMENUBAR SHOWING THE FIRST DCSUBMENU
Posted: Wed Aug 25, 2021 6:38 am
by rdonnay
Aha, sending the event to the dialog instead of the menu worked. Congrats.
Re: START DCMENUBAR SHOWING THE FIRST DCSUBMENU
Posted: Fri Aug 27, 2021 1:33 am
by Diego Euri Almanzar
Exactly, Roger.
Thanks.