Re: Questions of zero level
Posted: Sun Mar 11, 2012 10:58 am
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
*******************************************
*** Исследовние меню бар ***
*******************************************
#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