Adding control context menu to c:\hmg.3.4.4\samples\controls\splitbox\splitbox_1.prg,
does not work as expected. am I missed something ?
Code: Select all
/*
* HMG - Harbour Win32 GUI library Demo
*
* Copyright 2002 Roberto Lopez <mail.box.hmg@gmail.com>
* http://www.hmgforum.com//
*/
#include "hmg.ch"
Function Main
DEFINE WINDOW Form_1 ;
AT 0,0 ;
WIDTH 800 HEIGHT 600 ;
TITLE 'HMG SplitBox Demo' ;
MAIN ;
FONT 'Arial' SIZE 10
DEFINE STATUSBAR
STATUSITEM 'HMG Power Ready - Click / Drag Grippers And Enjoy !'
END STATUSBAR
DEFINE MAIN MENU
POPUP '&File'
ITEM '&Disable ToolBar Button' ACTION Form_1.SplitBox.ToolBar_1.Button_1.Enabled := .F.
ITEM '&Enable ToolBar Button' ACTION Form_1.SplitBox.ToolBar_1.Button_1.Enabled := .T.
ITEM 'Get ToolBar Button Caption' ACTION MsgInfo ( Form_1.SplitBox.ToolBar_1.Button_1.Caption )
SEPARATOR
ITEM 'Get EditBox Value' ACTION MsgInfo ( Form_1.SplitBox.Edit_1.Value )
ITEM 'Get Grid Value' ACTION MsgInfo ( Str ( Form_1.SplitBox.Grid_1.Value ) )
ITEM 'Get List Value' ACTION MsgInfo ( Str ( Form_1.SplitBox.List_1.Value ) )
SEPARATOR
ITEM 'Set EditBox Value' ACTION Form_1.SplitBox.Edit_1.Value := 'New Value'
ITEM 'Set Grid Value' ACTION Form_1.SplitBox.Grid_1.Value := 2
ITEM 'Set List Value' ACTION Form_1.SplitBox.List_1.Value := 5
SEPARATOR
ITEM 'Disable EditBox' ACTION Form_1.SplitBox.Edit_1.Enabled := .f.
ITEM 'Disable Grid' ACTION Form_1.SplitBox.Grid_1.Enabled := .f.
ITEM 'Disable List' ACTION Form_1.SplitBox.List_1.Enabled := .f.
SEPARATOR
ITEM 'Enable EditBox' ACTION Form_1.SplitBox.Edit_1.Enabled := .t.
ITEM 'Enable Grid' ACTION Form_1.SplitBox.Grid_1.Enabled := .t.
ITEM 'Enable List' ACTION Form_1.SplitBox.List_1.Enabled := .t.
SEPARATOR
ITEM 'Hide EditBox' ACTION Form_1.SplitBox.Edit_1.Hide()
ITEM 'Show EditBox' ACTION Form_1.SplitBox.Edit_1.Show()
SEPARATOR
ITEM 'Exit' ACTION Form_1.Release
END POPUP
POPUP '&Help'
ITEM 'About' ACTION MsgInfo ("HMG SplitBox Demo","A COOL Feature ;)")
END POPUP
END MENU
DEFINE SPLITBOX
DEFINE TOOLBAR ToolBar_1 BUTTONSIZE 85,85 FLAT
BUTTON Button_1 CAPTION '&More ToolBars...' PICTURE 'button1.bmp' ACTION MsgInfo('Click! 1') TOOLTIP 'ONE'
BUTTON Button_2 CAPTION '&Button 2' PICTURE 'button2.bmp' ACTION MsgInfo('Click! 2') TOOLTIP 'TWO'
BUTTON Button_3 CAPTION 'Button &3' PICTURE 'button3.bmp' ACTION MsgInfo('Click! 3') TOOLTIP 'THREE'
END TOOLBAR
LISTBOX List_1 ;
WIDTH 200 ;
HEIGHT 400 ;
ITEMS {'Item 1','Item 2','Item 3','Item 4','Item 5'} ;
VALUE 3 ;
TOOLTIP 'ListBox 1'
GRID Grid_1 ;
WIDTH 200 ;
HEIGHT 400 ;
HEADERS {'Last Name','First Name'} ;
WIDTHS {100,100};
ITEMS { {'Simpson','Homer'} , {'Mulder','Fox'} } VALUE 1 ;
TOOLTIP 'Grid Control'
EDITBOX Edit_1 ;
WIDTH 200 ;
HEIGHT 400 ;
VALUE 'EditBox!!' ;
TOOLTIP 'EditBox' ;
MAXLENGTH 255
END SPLITBOX
[b][color=blue]
Define_Control_Context_Menu ("ToolBar_1")
Define_Control_Context_Menu ("List_1")
Define_Control_Context_Menu ("Grid_1")
Define_Control_Context_Menu ("Edit_1")
[/color][/b]
END WINDOW
CENTER WINDOW Form_1
ACTIVATE WINDOW Form_1
Return Nil
[b][color=blue]
PROCEDURE Define_Control_Context_Menu (cComponent)
Do Case
Case cComponent="Label_1"
DEFINE CONTROL CONTEXTMENU &cComponent OF Form_1
ITEM "Label 1" ACTION MsgInfo("Label 1")
ITEM "Label 2" ACTION MsgInfo("Label 2")
ITEM "Label 3" ACTION MsgInfo("Label 3")
END MENU
Case cComponent="Button_1"
DEFINE CONTROL CONTEXTMENU &cComponent OF Form_1
ITEM "Button 1" ACTION MsgInfo("Button 1")
ITEM "Button 2" ACTION MsgInfo("Button 2")
ITEM "Button 3" ACTION MsgInfo("Button 3")
END MENU
Case cComponent="Button_2"
DEFINE CONTROL CONTEXTMENU &cComponent OF Form_1
ITEM "Button 4" ACTION MsgInfo("Button 4")
ITEM "Button 5" ACTION MsgInfo("Button 5")
ITEM "Button 6" ACTION MsgInfo("Button 6")
END MENU
Case cComponent="Check_1"
DEFINE CONTROL CONTEXTMENU &cComponent OF Form_1
ITEM "Check 1" ACTION MsgInfo("Check 1")
ITEM "Check 2" ACTION MsgInfo("Check 2")
ITEM "Check 3" ACTION MsgInfo("Check 3")
END MENU
Case cComponent="List_1"
DEFINE CONTROL CONTEXTMENU &cComponent OF Form_1
ITEM "List 1" ACTION MsgInfo("List 1")
ITEM "List 2" ACTION MsgInfo("List 2")
ITEM "List 3" ACTION MsgInfo("List 3")
END MENU
Case cComponent="Combo_1"
DEFINE CONTROL CONTEXTMENU &cComponent OF Form_1
ITEM "Combo 1" ACTION MsgInfo("Combo 1")
ITEM "Combo 2" ACTION MsgInfo("Combo 2")
ITEM "Combo 3" ACTION MsgInfo("Combo 3")
END MENU
Case cComponent="CheckBtn_1"
DEFINE CONTROL CONTEXTMENU &cComponent OF Form_1
ITEM "CheckBtn 1" ACTION MsgInfo("CheckBtn 1")
ITEM "CheckBtn 2" ACTION MsgInfo("CheckBtn 2")
ITEM "CheckBtn 3" ACTION MsgInfo("CheckBtn 3")
END MENU
Case cComponent="Grid_1"
DEFINE CONTROL CONTEXTMENU &cComponent OF Form_1
ITEM "Grid 1" ACTION MsgInfo("Grid 1")
ITEM "Grid 2" ACTION MsgInfo("Grid 2")
ITEM "Grid 3" ACTION MsgInfo("Grid 3")
END MENU
Case cComponent="Slider_1"
DEFINE CONTROL CONTEXTMENU &cComponent OF Form_1
ITEM "Slider 1" ACTION MsgInfo("Slider 1")
ITEM "Slider 2" ACTION MsgInfo("Slider 2")
ITEM "Slider 3" ACTION MsgInfo("Slider 3")
END MENU
Case cComponent="Image_1"
DEFINE CONTROL CONTEXTMENU &cComponent OF Form_1
ITEM "Image 1" ACTION MsgInfo("Image 1")
ITEM "Image 2" ACTION MsgInfo("Image 2")
ITEM "Image 3" ACTION MsgInfo("Image 3")
END MENU
Case cComponent="RadioGroup_1"
DEFINE CONTROL CONTEXTMENU &cComponent OF Form_1
ITEM "RadioGroup 1" ACTION MsgInfo("RadioGroup 1")
ITEM "RadioGroup 2" ACTION MsgInfo("RadioGroup 2")
ITEM "RadioGroup 3" ACTION MsgInfo("RadioGroup 3")
END MENU
Case cComponent="Tab_1"
DEFINE CONTROL CONTEXTMENU &cComponent OF Form_1
ITEM "Tab 1" ACTION MsgInfo("Tab 1")
ITEM "Tab 2" ACTION MsgInfo("Tab 2")
ITEM "Tab 3" ACTION MsgInfo("Tab 3")
END MENU
Case cComponent="ProgressBar_1"
DEFINE CONTROL CONTEXTMENU &cComponent OF Form_1
ITEM "ProgressBar 1" ACTION MsgInfo("ProgressBar 1")
ITEM "ProgressBar 2" ACTION MsgInfo("ProgressBar 2")
ITEM "ProgressBar 3" ACTION MsgInfo("ProgressBar 3")
END MENU
Case cComponent="ToolBar_1"
DEFINE CONTROL CONTEXTMENU &cComponent OF Form_1
ITEM "ToolBar 1" ACTION MsgInfo("ToolBar 1")
ITEM "ToolBar 2" ACTION MsgInfo("ToolBar 2")
ITEM "ToolBar 3" ACTION MsgInfo("ToolBar 3")
END MENU
Case cComponent="StatusBar"
DEFINE CONTROL CONTEXTMENU &cComponent OF Form_1
ITEM "StatusBar 1" ACTION MsgInfo("StatusBar 1")
ITEM "StatusBar 2" ACTION MsgInfo("StatusBar 2")
ITEM "StatusBar 3" ACTION MsgInfo("StatusBar 3")
END MENU
Case cComponent="Spinner_1"
DEFINE CONTROL CONTEXTMENU &cComponent OF Form_1
ITEM "Spinner 1" ACTION MsgInfo("Spinner 1")
ITEM "Spinner 2" ACTION MsgInfo("Spinner 2")
ITEM "Spinner 3" ACTION MsgInfo("Spinner 3")
END MENU
Endcase
RETURN
[/color][/b]
TIA
best rgds,
Chang