Questions of zero level

This forum is for eXpress++ general support.
Message
Author
User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

Re: Questions of zero level

#41 Post by Eugene Lutsenko »

You in what advantage of commands particularly consists couldn't tell: DCMENUBAR and DCMENUITEM in comparison with XbpMenu () and addItem ()? The matter is that I need to organize the multilevel treelike (hierarchical) menu of that type that I have made by means of XbpMenu () and addItem () in the program: http://lc.kubagro.ru/Alaska/Aidos-x.exe and I don't know, how it to make by means of commands DCMENUBAR and DCMENUITEM, and by means of XbpMenu () and addItem () have already made. You couldn't prompt, and can be even to give an example formations of 2nd level of the falling menu? Whether it is important to know certainly we will apply this way to creation of 3rd and subsequent levels of the menu. But I and itself can check up it. I admit, syntax and in general a way of the reference with commands DCMENUBAR and DCMENUITEM is pleasant to me more and I would use them.


*******************************************
*** Исследовние меню бар ***
*******************************************

#include "Gra.ch "
#include "xbp.ch "
#include "dcdialog.CH"
#include "appevent.ch"
#pragma library( "XBTBASE1.LIB" )
#pragma library( "XBTBASE2.LIB" )
#pragma library( "dclipx.lib " )
#pragma library( "dclip2.lib " )

PROCEDURE Main

SET COLLATION TO SYSTEM
SET COLLATION TO ASCII

SET COLOR TO N/W,W+/B
SetMouse( .T. )

Xtest()

RETURN

/*
This example displays a dialogue box with two tab pages
and a menu with 3 submenus: File, Edit, Util.
*/


PROCEDURE Xtest()

LOCAL GetList := {}, oFileMenu, oMenuBar, oEditMenu, oMemo, oUtilMenu, ;
cMemo

USE COLLECT

cMemo := COLLECT->memo

@ 0,0 DCMULTILINE cMemo SIZE 70,7 FONT "10.Courier.Bold"


/* ---- Menu ---- */

DCMENUBAR oMenuBar

DCSUBMENU oFileMenu PROMPT "&Файл" PARENT oMenuBar

DCMENUITEM "&Открыть файл" PARENT oFileMenu ACTION {||Msgbox('OpenFile')}
DCMENUITEM "&Закрыть файл" PARENT oFileMenu ACTION {||Msgbox('CloseFile')}
DCMENUITEM "&Сжать файл" PARENT oFileMenu ACTION {||Msgbox('Packfile')}

DCSUBMENU oEditMenu PROMPT "&Редактирование" PARENT oMenuBar

DCMENUITEM "&Следующая запись" PARENT oEditMenu ACTION {||dbSkip() , cMemo := COLLECT->memo, DC_GetRefresh(GetList)} ACCELKEY xbeK_ALT_N WHEN {||!Eof()}
DCMENUITEM "&Предыдущая запись" PARENT oEditMenu ACTION {||dbSkip(-1) , cMemo := COLLECT->memo, DC_GetRefresh(GetList)} ACCELKEY xbeK_ALT_P WHEN {||!Bof()}
DCMENUITEM "&Начало файла" PARENT oEditMenu ACTION {||dbGoTop() , cMemo := COLLECT->memo, DC_GetRefresh(GetList)} ACCELKEY xbeK_ALT_T
DCMENUITEM "&Конец файла" PARENT oEditMenu ACTION {||dbGoBottom(), cMemo := COLLECT->memo, DC_GetRefresh(GetList)} ACCELKEY xbeK_ALT_B

DCSUBMENU oUtilMenu PROMPT "&Утилиты" PARENT oMenuBar

DCMENUITEM "Копирование файла" PARENT oUtilMenu ACTION {||Msgbox('CopyFile')}
DCMENUITEM "Перемещение файла" PARENT oUtilMenu ACTION {||Msgbox('MoveFile')}
DCMENUITEM "Открытие окна со своим меню" PARENT oUtilMenu ACTION {||Xtest2()}

DCREAD GUI TITLE 'Меню демо' FIT ADDBUTTONS

RETURN

********* Открытие окна со своим меню
PROCEDURE Xtest2()

LOCAL GetList := {}, oFileMenu, oMenuBar, oEditMenu, oMemo, oUtilMenu, ;
cMemo

USE COLLECT

cMemo := COLLECT->memo

@ 0,0 DCMULTILINE cMemo SIZE 70,7 FONT "10.Courier.Bold"


/* ---- Menu ---- */

DCMENUBAR oMenuBar

DCSUBMENU oFileMenu PROMPT "&Файл-2" PARENT oMenuBar

DCMENUITEM "&Открыть файл-2" PARENT oFileMenu ACTION {||Msgbox('OpenFile')}
DCMENUITEM "&Закрыть файл-2" PARENT oFileMenu ACTION {||Msgbox('CloseFile')}
DCMENUITEM "&Сжать файл-2" PARENT oFileMenu ACTION {||Msgbox('Packfile')}

DCSUBMENU oEditMenu PROMPT "&Редактирование-2" PARENT oMenuBar

DCMENUITEM "&Следующая запись-2" PARENT oEditMenu ACTION {||dbSkip() , cMemo := COLLECT->memo, DC_GetRefresh(GetList)} ACCELKEY xbeK_ALT_N WHEN {||!Eof()}
DCMENUITEM "&Предыдущая запись-2" PARENT oEditMenu ACTION {||dbSkip(-1) , cMemo := COLLECT->memo, DC_GetRefresh(GetList)} ACCELKEY xbeK_ALT_P WHEN {||!Bof()}
DCMENUITEM "&Начало файла-2" PARENT oEditMenu ACTION {||dbGoTop() , cMemo := COLLECT->memo, DC_GetRefresh(GetList)} ACCELKEY xbeK_ALT_T
DCMENUITEM "&Конец файла-2" PARENT oEditMenu ACTION {||dbGoBottom(), cMemo := COLLECT->memo, DC_GetRefresh(GetList)} ACCELKEY xbeK_ALT_B

DCSUBMENU oUtilMenu PROMPT "&Утилиты-2" PARENT oMenuBar

DCMENUITEM "Копирование файла-2" PARENT oUtilMenu ACTION {||Msgbox('CopyFile')}
DCMENUITEM "Перемещение файла-2" PARENT oUtilMenu ACTION {||Msgbox('MoveFile')}

DCREAD GUI TITLE 'Второе окно со своим меню' FIT ADDBUTTONS

RETURN

User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

Re: Questions of zero level

#42 Post by Eugene Lutsenko »

As possible was change this program that submenu was opened not in new window, but in same, but from the side (layered tree-type menu).

You couldn't result a working example of the program of construction of the menu of type such:

1.
1.1.
1.1.1.
1.1.2.
1.2.
1.2.1.
1.2.2.
1.2.3.
1.2.3.1.
1.2.3.1.1.
1.2.3.1.2.
1.2.3.1.2.1.
1.2.3.1.2.2.
1.2.3.1.2.3.
1.2.3.2.
1.2.3.3.
2.
2.1.
2.2.
2.3.
2.3.1.
2.3.2.
2.3.2.1.
2.3.2.1.1.
2.3.2.1.2.
2.3.2.2.
2.3.2.3.
2.3.2.4.
2.3.3.
2.3.3.1.
2.3.3.2.
2.3.3.3.

By means of functions:

Example:

aMenu := DC_MenuLoad( "MAINMENU" )
DC_ASave( aMenu, "MAINMENU.DCM" )
aMenu := DC_ARestore( "MAINMENU.DCM" )


Examples:

/* -- Load the Main Menu -- */
aPreMenu := DC_MENULOAD( 'MAINMENU' )

/* -- Compile the menu -- */
aMenuMain := DC_MenuCompile( aPreMenu )

/* -- Install the menu -- */
DC_MenuOSys( aMenuMain, oDialog )


Source/Library:

_DCMENUE.PRG

See Also:

dc_menurun(), dc_menuedit()


User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

Re: Questions of zero level

#44 Post by Eugene Lutsenko »

Thank you for your advice. I did it, finally! But could you tell what exactly is the advantage of DCMENUBAR and DCMENUITEM comparing to XbpMenu () and addItem ()?

I need to organize a multi-level tree (hierarchical) menu, thу same type that I did with XbpMenu () and addItem () in this program: http://lc.kubagro.ru/Alaska/Aidos-x.exe and I do not know how to do it with the commands like DCMENUBAR and DCMENUITEM, but with the help of XbpMenu () and addItem () it is already done. Could you tell, and maybe even give an example of 2-level drop-down menu with DCMENUBAR and DCMENUITEM? I confess, I liked the syntax and general way of working with DCMENUBAR and DCMENUITEM commands and I'd like to use them instead.

You couldn't give the simplest example of the user function for DC_DBEDIT (), providing editing of values of fields of a database and the menu for management of operations with records: addition, removal, search, etc. Whether it is possible to enter data into DC_DBEDIT about an echo press asterisks without display of symbols as for PASSWORD?

Cliff Wiernik
Posts: 605
Joined: Thu Jan 28, 2010 9:11 pm
Location: Steven Point, Wisconsin USA
Contact:

Re: Questions of zero level

#45 Post by Cliff Wiernik »

See next message.
Last edited by Cliff Wiernik on Wed Mar 14, 2012 10:27 am, edited 1 time in total.

Cliff Wiernik
Posts: 605
Joined: Thu Jan 28, 2010 9:11 pm
Location: Steven Point, Wisconsin USA
Contact:

Re: Questions of zero level

#46 Post by Cliff Wiernik »

Here is an example of using the items you indicate:

Code: Select all

  DCMENUBAR oMenuBar EVAL {|o| o:endmenu := {|| m->G_oMsgBox:setCaption('')} }
 
  //------------------------------ File Menu ----------------------------

    DCSUBMENU oFileMenu PROMPT '~File' PARENT oMenuBar ;
        MESSAGE 'System Login/Exit'

      DCMENUITEM '~Sign-On' PARENT oFileMenu ;
        ACTION {|| lExclUser := .F.,            ;
                   iif( !S_signon(@lExclUser,@lExit,oOperator,GetList,@lValidLogin,@m->oCompCode),    ;
                   iif(lExit,PostAppevent(xbeP_Keyboard,xbeK_ALT_F4,,m->G_MainWindow),NIL),NIL)} ;
        MESSAGE 'Log on to System'

      DCMENUITEM 'Change System ~Date'+chr(9)+'F4' PARENT oFileMenu ;
        ACTION {|| S_gcurrdate( m->G_oTodaysdate )} MESSAGE 'Change current system processing date' ;   // PC CAW 05-11-09 oTodaysdate -> m->G_oTodaysdate
        ACCELKEY {xbeK_F4}

      DCMENUITEM 'Current ~Users on System'+chr(9)+'Alt-F7' PARENT oFileMenu ;
        ACTION {|| S_CUserOnSys()} MESSAGE 'Display current users on system' ;
        ACCELKEY {xbeK_ALT_F7}
        
      DCMENUITEM 'Contract ~Purchase Price'+chr(9)+'Alt-F8' PARENT oFileMenu ;
        ACTION {|| S_contdisc()} MESSAGE 'Determine purchase price for given contract parameters' ;
        ACCELKEY {xbeK_ALT_F8}

      DCMENUITEM 'E~xit' PARENT oFileMenu ;
        ACTION {|| DC_ReadGuiEvent(DCGUI_EXIT_OK,GetList)} ;
        MESSAGE 'Close Screens and Exit Program'
 
  //------------------------------ Account Menu ----------------------------

    DCSUBMENU oAccountMenu PROMPT '~Account' PARENT oMenuBar ;
        MESSAGE 'Accounts Menu' ;
        WHEN {|| m->oper_init # 'ZZZ' .AND. lValidLogin .AND. m->access[182] $ 'N ' }   // PC FIS 01-26-05
        
      IF SetOption(12) .AND. (SetOption(2) .OR. SetOption(3) .OR. SetOption(4) .OR. SetOption(10) .OR. SetOption(7))
        DCMENUITEM '~Applications' PARENT oAccountMenu ;
          ACTION {|| GuiRun( 'Applications',3,.F.,.T.,.T.,'2','APPS','Applications')} ;
          MESSAGE 'Enter New Applications' ;
          WHEN {|| m->access[13] # 'N' .AND. S_OptionCertified(.T.,m->oper_init) }                              // certified
      ENDIF

      IF SetOption(2)
        DCMENUITEM '~Lease' PARENT oAccountMenu ;
          ACTION {|| GuiRun( '',2,.F.,.T.,.T.,'3','LEASEMST','Lease Account Maintenance')} ;
          MESSAGE 'Modify/Review Lease Accounts' ;
          WHEN {|| m->access[9] # 'N' .AND. SetOption(2) .AND. S_OptionCertified(.T.,m->oper_init)}             // certified
      ENDIF

      IF SetOption(3)
        DCMENUITEM 'Pre~computed' PARENT oAccountMenu ;
          ACTION {|| GuiRun( '',2,.F.,.T.,.T.,'2','CONTMST','Precomputed Account Maintenance')} ;
          MESSAGE 'Modify/Review Precomputed Contracts' ;
          WHEN {|| m->access[10] # 'N' .AND. SetOption(3) .AND. S_OptionCertified(.T.,m->oper_init)}            // certified
      ENDIF

      IF SetOption(4)
        DCMENUITEM '~Simple' PARENT oAccountMenu ;
          ACTION {|| GuiRun( '',2,.F.,.T.,.T.,'2','SIMPLMST','Simple Interest Account Maintenance')} ;
          MESSAGE 'Modify/Review Simple Interest Accounts' ;
          WHEN {|| m->access[11] # 'N' .AND. SetOption(4) .AND. S_OptionCertified(.T.,m->oper_init)}            // certified
      ENDIF

      IF SetOption(10)
        DCMENUITEM 'Standard ~Billing' PARENT oAccountMenu ;
          ACTION {|| GuiRun( '',2,.F.,.T.,.T.,'3','BILLING','Standard Billing Account Maintenance')} ;
          MESSAGE 'Modify/Review Standard Billing Accounts' ;
          WHEN {|| (m->access[253] # 'N') .AND. SetOption(10) .AND. S_OptionCertified(.T.,m->oper_init)}        // certified
      ENDIF

      IF SetOption(7)
        DCMENUITEM '~Revolving' PARENT oAccountMenu ;
          ACTION {|| GuiRun( '',2,.F.,.T.,.T.,'2','REVOLVE','Revolving Account Maintenance')} ;
          MESSAGE 'Modify/Review Revolving Accounts' ;
          WHEN {|| m->access[26] # 'N' .AND. SetOption(7) .AND. S_OptionCertified(.T.,m->oper_init)}            // certified
      ENDIF

      IF SetOption(3) .OR. SetOption(4) .OR. SetOption(10) .OR. SetOption(7)                                    // if contract/simple/billing/revolve, not lease        
        DCMENUITEM 'Recover~y' PARENT oAccountMenu ;
          ACTION {|| GuiRun( '',2,.F.,.T.,.T.,'3','RECOVERY','Recovery Account Maintenance')} ;
          MESSAGE 'Modify/Review Recovery Accounts ' ;
          WHEN {|| m->access[14] # 'N' .AND. S_OptionCertified(.T.,m->oper_init)}         // PC FIS 01-26-05 was [200]    // certified
      ENDIF

      IF SetOption(2) .OR. SetOption(3) .OR. SetOption(4) .OR. SetOption(10) .OR. SetOption(7) 
        DCMENUITEM 'L~ocate' PARENT oAccountMenu ;
          ACTION {|| GuiRun( '',1,.F.,.T.,.T.,'2','LOCACCT','Locate Accounts')} ;
          MESSAGE 'Locate Accounts '  ;
          WHEN {|| m->maincomp == 'Y' .AND. m->access[224] # 'N' .AND. S_OptionCertified(.T.,m->oper_init)}     // certified // PC FIS 01-26-05    
      ENDIF
         
  //------------------------------ Maintenance Menu ----------------------------

    DCSUBMENU oMaintMenu PROMPT '~Maintenance' PARENT oMenuBar ;
        MESSAGE 'Maintain Various System Files and Databases' ;
        WHEN {|| m->oper_init # 'ZZZ' .AND. lValidLogin .AND. m->access[183] $ 'N ' }   // PC FIS 01-26-05
    
    //------------------------ System Configuration Menu ------------------------     // PC FIS 12-12-06

    DCSUBMENU oConfigMenu PROMPT 'Con~figuration' PARENT oMaintMenu ;                    // PC FIS 12-12-06
      MESSAGE 'Maintain System Configuration Files' ;
      WHEN {|| S_MenuItemAccess( {1,264} ) }
        
      DCMENUITEM '~Configuration' PARENT oConfigMenu ;                                  // PC FIS 12-12-06 was oMaintMenu
        ACTION {|| iif(m->oper_init $ 'MNT,CAW,FIS,BDJ' .OR. LB_YrOnlyUser(m->oper_init), ;
                                  ( GuiRun( '',2,.F.,.T.,.T.,'4','CONFIG','Maintain System Configuration Parameters',.T.), ;
                                    LB_ResetExcl(m->oper_init) ),  ;
                                       GuiRun( '',2,.F.,.T.,.T.,'4','CONFIG','Maintain System Configuration Parameters',.F.)), sleep(100) } ;
        MESSAGE 'Maintain System Configuration Parameters' ;
        WHEN {|| m->access[1] # 'N' .AND. S_OptionCertified(.T.,m->oper_init)}                                  // certified
        
      DCMENUITEM 'System ~Options' PARENT oConfigMenu ;                                 // PC FIS 12-12-06
        ACTION {|| iif(m->oper_init $ 'MNT,CAW,FIS,BDJ' .OR. LB_YrOnlyUser(m->oper_init), ;
                                  ( GuiRun( '',2,.F.,.T.,.T.,'4','FCAOPTSMNT','Maintain System Options',.T.),    ;
                                    LB_ResetExcl(m->oper_init) ),  ;
                                    GuiRun( '',2,.F.,.T.,.T.,'4','FCAOPTSMNT','Maintain System Options',.F.) ), sleep(100) } ;
        MESSAGE 'Maintain System Options' ;
        WHEN {|| m->access[264] # 'N' .AND. S_OptionCertified(.T.,m->oper_init)}   // .F. 2-21-10 **CERT**                            // **NOT CERTIFIED**

    //-------------------------- System Configuration Menu -------------------------     // PC FIS 12-12-06
 
    DCMENUITEM SEPARATOR PARENT oMaintMenu
    
      DCMENUITEM '~Dealer' PARENT oMaintMenu ;
        ACTION {|| GuiRun( '',2,.F.,.T.,.T.,'2','DEALER','Dealer Maintenance')} ;
        MESSAGE 'Maintain Dealer Database'  ;
        WHEN {|| m->access[2] # 'N' .AND. S_OptionCertified(.T.,m->oper_init)}                                  // certified
        
      DCMENUITEM 'Sec~ured Party' PARENT oMaintMenu ;
        ACTION {|| GuiRun( '',1,.F.,.T.,.T.,'4','SECURITY','Secured Party Maintenance')} ;
        MESSAGE 'Maintain Secured Party Database'  ;
        WHEN {|| m->access[3] # 'N' .AND. S_OptionCertified(.T.,m->oper_init)}                                  // certified

      DCMENUITEM 'Remo~te Collector' PARENT oMaintMenu ;
        ACTION {|| GuiRun( '',1,.F.,.T.,.T.,'4','REMOTE','Remote Collector Maintenance')} ;
        MESSAGE 'Maintain Remote Collector File'  ;
        WHEN {|| m->access[21] # 'N'.AND. S_OptionCertified(.T.,m->oper_init)}  // PC FIS 01-26-05 was [2]      // certified
                
      DCMENUITEM SEPARATOR PARENT oMaintMenu
               
Menu looks like this.

File                
 Sign-on         
 Change System Dat
 Current Users        
 Quit                     
                           

Account
  Applications
  Lease
  Contract
  Simple
  Revolving

Maintenance
  Configuration
    Configuration
    System Options
  Dealer
  Secured Party

This all very easy to use. The last item, the system configuration menu generates the following structure shown at the bottom of the above code segment

Cliff

User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

Re: Questions of zero level

#47 Post by Eugene Lutsenko »

I thank for the answer. Therefore I also try to master these eXpress++ toolssince I see that it is more convenient, than in initial xBase++. I ask, if it is possible, to give an example the program creating the initial text of the program, realizing the hierarchical menu, from the external text file, type of that you brought, which would be set as parameter at program start. For me it is important, that this program could be compiled and started at once on execution.

Cliff Wiernik
Posts: 605
Joined: Thu Jan 28, 2010 9:11 pm
Location: Steven Point, Wisconsin USA
Contact:

Re: Questions of zero level

#48 Post by Cliff Wiernik »

Are you asking for a small example program that creates the initial program menu. I can do a small one that does not have much information so you can see it.

Cliff.

User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

Re: Questions of zero level

#49 Post by Eugene Lutsenko »

It would be very grateful. I so have understood that there is a possibility of automatic creation this programs on the basis of the menu in the form of a text file with different spaces of points of different level. I have correctly understood? Me it too interests. And still I of back many questions in my disgusting English above. Couldn't clear something. For example to result a small example of the program. EDITING a database in GUI, and also обеспчеивающей the elementary functions on management of it (addition, removal and copying of records)

reganc
Posts: 258
Joined: Thu Jan 28, 2010 3:08 am
Location: Hersham, Surrey, UK
Contact:

Re: Questions of zero level

#50 Post by reganc »

Eugene Lutsenko wrote:It would be very grateful. I so have understood that there is a possibility of automatic creation this programs on the basis of the menu in the form of a text file with different spaces of points of different level. I have correctly understood? Me it too interests. And still I of back many questions in my disgusting English above. Couldn't clear something. For example to result a small example of the program. EDITING a database in GUI, and also обеспчеивающей the elementary functions on management of it (addition, removal and copying of records)
Have you looked at Xdemo.exe? It shows various examples of the uses of Express++ commands and functions and has a set of sample 'applications' that show gui database access and navigation.
Regan Cawkwell
Real Business Applications Ltd
http://www.rbauk.com

Post Reply