Page 1 of 1

DCMENUITEM

Posted: Wed Mar 27, 2019 4:12 am
by unixkd
Hi Roger

In the code below, the 3rd element, of the :CARGO which suppose to be "MyDataHere" is NIL.

DCMENUITEM "My menu here";
CARGO "MyDataHere" ;
ACTION {|a,b,o| DC_Arrayview({a, o:items[a], o, o:cargo })}

Thanks.

Joe

Re: DCMENUITEM

Posted: Wed Mar 27, 2019 7:44 am
by Wolfgang Ciriack
Try o:cargo[3]

Re: DCMENUITEM

Posted: Wed Mar 27, 2019 2:48 pm
by unixkd
NIL is returned for o:cargo[3]

Re: DCMENUITEM

Posted: Sun Mar 31, 2019 12:53 pm
by rdonnay
Apparently this has never worked nor has it ever been tested.
I will need to remove the CARGO clause from the DCMENUITEM docs.

You can only apply CARGO to the DCSUBMENU object.
DCMENUITEM not not objects. They are indexed sub-items of the DCSUBMENU object.

Here is an example of way to use CARGO of DCSUBMENU to get what you want :

Code: Select all

 DCSUBMENU oMenuFile PROMPT 'File' PARENT oMenuBar ;
     CARGO {'Item 1 Cargo', ;
            'Item 2 Cargo', ;
            'Item 3 Cargo', ;
            'Item 4 Cargo', ;
            'Item 5 Cargo'}

    DCMENUITEM 'Data Tree Menu' PARENT oMenuFile ;
      ACTION {||GuiRun({|a|::TreeWindow()})} ;
      WHEN {||::oTree == nil}

    DCMENUITEM 'Create New Connection' PARENT oMenuFile ;
      ACTION {|a,b,o|(wtf DC_GetCargo(o)[2]), ::CreateNewConnection()} 

    DCMENUITEM 'Disconnect all Connections' PARENT oMenuFile ;
      ACTION {|a,b,o|(wtf DC_GetCargo(o)[3]), ::DisconnectConnections()}

    DCMENUITEM 'Restart SqlQuery.Exe' PARENT oMenuFile ;
      ACTION {||RunShell('',AppName(.t.),.t.,.t.),Sleep(10),_quit()}

    DCMENUITEM 'Edit SqlQuery.Ini File' PARENT oMenuFile ;
      ACTION {||RunShell('SqlQuery.ini','Notepad.exe')}

    DCMENUITEM 'Browse SqlQuery.Dbf (Dictionary) File' PARENT oMenuFile ;
      ACTION {||::BrowseSqlQueryDbf()}