START DCMENUBAR SHOWING THE FIRST DCSUBMENU

This forum is for eXpress++ general support.
Post Reply
Message
Author
Diego Euri Almanzar
Posts: 155
Joined: Thu Nov 05, 2020 10:51 am
Location: DOMINICAN REPUBLIC

START DCMENUBAR SHOWING THE FIRST DCSUBMENU

#1 Post 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.

Wolfgang Ciriack
Posts: 478
Joined: Wed Jan 27, 2010 10:25 pm
Location: Berlin Germany

Re: START DCMENUBAR SHOWING THE FIRST DCSUBMENU

#2 Post by Wolfgang Ciriack »

Perhaps you can send an PostAppEvent(xbeP_ItemSelected, , , oMyMenuBar) from the EVAL block of your DCREAD GUI.
_______________________
Best Regards
Wolfgang

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

Re: START DCMENUBAR SHOWING THE FIRST DCSUBMENU

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

Diego Euri Almanzar
Posts: 155
Joined: Thu Nov 05, 2020 10:51 am
Location: DOMINICAN REPUBLIC

Re: START DCMENUBAR SHOWING THE FIRST DCSUBMENU

#4 Post 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

Diego Euri Almanzar
Posts: 155
Joined: Thu Nov 05, 2020 10:51 am
Location: DOMINICAN REPUBLIC

Re: START DCMENUBAR SHOWING THE FIRST DCSUBMENU

#5 Post 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

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

Re: START DCMENUBAR SHOWING THE FIRST DCSUBMENU

#6 Post by rdonnay »

Aha, sending the event to the dialog instead of the menu worked. Congrats.
The eXpress train is coming - and it has more cars.

Diego Euri Almanzar
Posts: 155
Joined: Thu Nov 05, 2020 10:51 am
Location: DOMINICAN REPUBLIC

Re: START DCMENUBAR SHOWING THE FIRST DCSUBMENU

#7 Post by Diego Euri Almanzar »

Exactly, Roger.

Thanks.

Post Reply