FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for CA-Clipper Menu in dialog
Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM
Menu in dialog
Posted: Tue Aug 29, 2006 09:23 AM

Hello,

I can add a buttonbar on a dialog, but is it possible to have a menu (and buttonbar) in a dialog?

Thanks,
Marc

Regards,

Marc



FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Menu in dialog
Posted: Tue Aug 29, 2006 09:47 AM

Yes, just build the menu in the ON INIT clause.

EMG

Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM
Menu in dialog
Posted: Tue Aug 29, 2006 09:53 AM

Thanks Enrico,

Why didn't I think of doing that... :oops: .
I already do it for my buttonbar...

Marc

Regards,

Marc



FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Menu in dialog
Posted: Tue Aug 29, 2006 07:21 PM
This is a working sample:

#include "Fivewin.ch"


FUNCTION MAIN()

    LOCAL oDlg

    DEFINE DIALOG oDlg

    @ 2, 1 BUTTON "&Close";
           ACTION oDlg:End()

    ACTIVATE DIALOG oDlg;
             ON INIT BUILDMENU( oDlg );
             CENTER

    RETURN NIL


STATIC FUNCTION BUILDMENU( oDlg )

    LOCAL oMenu

    MENU oMenu
        MENUITEM "&Test"

        MENU
            MENUITEM "&Test1";
                     ACTION MSGINFO( "Test1" )

            MENUITEM "&Test2";
                     ACTION MSGINFO( "Test2" )

            MENUITEM "&Test3";
                     ACTION MSGINFO( "Test3" )
        ENDMENU
    ENDMENU

    oDlg:SetMenu( oMenu )

    RETURN NIL


EMG
Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM
Menu in dialog
Posted: Thu Aug 31, 2006 06:30 AM
Enrico,

I just found a strange effect after implementing this.
The buttons, checkboxes and radioboxes don't work any more. If you click on them, nothing happens.
The onclicks on bitmaps, barbuttons and the doubleclick on listboxes still works.
If I comment out the STATIC FUNCTION BUILDMENU( oDlg ), everthing works again.
Is there something I have to change?

Marc
Regards,

Marc



FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Menu in dialog
Posted: Thu Aug 31, 2006 10:37 AM

Sorry, I'm unable to replicate that problem here.

EMG

Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM
Menu in dialog
Posted: Thu Aug 31, 2006 12:21 PM
Here is an example so you can see that it's not working after calling the menu.
#INCLUDE "fivewin.CH"
FUNCTION test()
   local oDlg
   local vspare := .f.

   DEFINE DIALOG oDlg RESOURCE "test"
   REDEFINE CHECKBOX vspare   ID 104 of oDlg ON CHANGE(msginfo(vspare))
   REDEFINE BUTTON  ID 101 OF oDlg ACTION msginfo('OK')
   REDEFINE BUTTON  ID 102 OF oDlg ACTION msginfo('Cancel')
   REDEFINE BUTTON  ID 103 OF oDlg ACTION msginfo('Help')
   ACTIVATE DIALOG oDlg CENTERED on init BUILDMENU( oDlg )
RETURN nil

STATIC FUNCTION buildmenu( odlg )
   LOCAL oMenu

   IF .t. // enable/disable menu
      MENU oMenu
      MENUITEM "&Test"

      MENU
      MENUITEM "&Test1";
      ACTION MSGINFO( "Test1" )

      MENUITEM "&Test2";
      ACTION MSGINFO( "Test2" )

      MENUITEM "&Test3";
      ACTION MSGINFO( "Test3" )
      ENDMENU
      ENDMENU

      oDlg:SetMenu( oMenu )
   ENDIF

RETURN NIL


Here is the rc-file
/****************************************************************************


test.rc

produced by Borland Resource Workshop


*****************************************************************************/


TEST DIALOG 6, 15, 207, 111
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Test"
FONT 8, "MS Sans Serif"
{
 DEFPUSHBUTTON "OK", 101, 148, 6, 50, 14
 PUSHBUTTON "Cancel", 102, 148, 24, 50, 14
 PUSHBUTTON "Help", 103, 148, 42, 50, 14
 CHECKBOX "Checkbox", 104, 7, 14, 93, 11, BS_AUTOCHECKBOX | WS_TABSTOP
}



Changing the line IF .t. // enable/disable menu you can disable/enable the menu.

Marc
Regards,

Marc



FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Menu in dialog
Posted: Thu Aug 31, 2006 12:33 PM

Works fine here, sorry.

EMG

Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM
Menu in dialog
Posted: Thu Aug 31, 2006 01:23 PM

That's strange, here are the exe-files compiled on my PC.

http://www.vms.be/FWTest/TestMenu.zip

Marc

Regards,

Marc



FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Menu in dialog
Posted: Thu Aug 31, 2006 03:26 PM

I confirm the problem with your EXE. Do you want mine?

EMG

Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM
Menu in dialog
Posted: Thu Aug 31, 2006 03:45 PM

No need to send your exe-file, I you say they are working, I'am sure they do, but could be that I'am using FW195 and you are using a newer release?

Marc

Regards,

Marc



FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM

Continue the discussion