Page 1 of 3

CONTEXT MENU

Posted: Fri Nov 16, 2012 7:06 pm
by Pablo César
HMG's context menu is predefined for whole window, not for every single element of window.

Moreover we need a ON RIGHT CLICK event for all controls.

Words of my coleagues and I also agree. Would be so usefull for each controls.

Re: CONTEXT MENU

Posted: Sat Nov 17, 2012 3:46 am
by Rathinagiri
Yes. It is a nice idea.

'C' Gurus, please come for help.

Re: CONTEXT MENU

Posted: Sat Nov 17, 2012 9:43 am
by bpd2000
I am also eagerly awaiting such extension

Re: CONTEXT MENU

Posted: Sat Nov 17, 2012 9:52 am
by danielmaximiliano
Hola Pablo Cesár:
Hace tiempo necesitaba este tipo de control para mi aplicacion con "Tab", para ser mas practico era necesario utilizar el boton derecho del mouse y llamar al menu contextual de dicho control, pero no pude.
utilizando TextCrawler mire un poco dentro de las tripas de Minigui y encontre esto.
TextCrawler_2012-11-17_06-41-40.jpg
TextCrawler_2012-11-17_06-41-40.jpg (119.5 KiB) Viewed 6857 times
Como el Ejemplo de MYBUTTON se puede integrar en el formato UCI. :mrgreen:

mire aqui : c:\MiniGUI\Include\i_controlmisc.ch y tambien en c:\MiniGUI\Include\i_menu.ch

Hello Pablo Cesár:
Long ago this type of control needed for my application with "Tab" to be more practical was necessary to use the right mouse button and call the context menu of the control, but could not.
using TextCrawler look a little into the guts of MiniGUI and found this.



MyButton Example As can be integrated into the UCI format. : mrgreen:

Look here: c:\MiniGUI\Include\i_controlmisc.ch y tambien en c:\MiniGUI\Include\i_menu.ch

Re: CONTEXT MENU

Posted: Sat Nov 17, 2012 6:46 pm
by Pablo César
Como el Ejemplo de MYBUTTON se puede integrar en el formato UCI.

MyButton Example As can be integrated into the UCI format.
Yeah, I will try on monday. Thank you Daniel !!

CONTEXT MENU

Posted: Thu Apr 11, 2013 8:06 pm
by Pablo César
Now with new implements of ContextMenu options: IsContextMenuDefined and ReleaseContextMenu we can manage diferent ContextMenu. But the problem I did not found the way to run properly with other components. It is working for Button and Form. Please note:
Screen68.PNG
Screen68.PNG (11.39 KiB) Viewed 6490 times
    Source code:

Code: Select all

/*
 Context Menu Individualized (Buttons only and Form)
*/

#include "hmg.ch"

Function Main()
DEFINE WINDOW Form_1 AT 164 , 292 WIDTH 320 HEIGHT 250 ;
	Main TITLE "Test of Individual Context Menu"  ;
	ON GOTFOCUS  {||On_Context_Menu("Global")}

    DEFINE BUTTON Button_1
        ROW    127
        COL    25
        WIDTH  100
        HEIGHT 28
        CAPTION "Button_1"
        ACTION   NIL
        FONTNAME  "Arial"
        FONTSIZE  9
        TOOLTIP  ""
        FONTBOLD  .F.
        FONTITALIC .F.
        FONTUNDERLINE .F.
        FONTSTRIKEOUT .F.
        ONGOTFOCUS  {||On_Context_Menu("Button_1")}
        ONLOSTFOCUS {||Off_Context_Menu()}
        HELPID  NIL
        FLAT    .F.
        TABSTOP .T.
        VISIBLE .T.
        TRANSPARENT .F.
    END BUTTON
	
	DEFINE BUTTON Button_2
        ROW    127
        COL    170
        WIDTH  100
        HEIGHT 28
        CAPTION "Button_2"
        ACTION   NIL
        FONTNAME  "Arial"
        FONTSIZE  9
        TOOLTIP  ""
        FONTBOLD  .F.
        FONTITALIC .F.
        FONTUNDERLINE .F.
        FONTSTRIKEOUT .F.
        ONGOTFOCUS  {||On_Context_Menu("Button_2")}
        ONLOSTFOCUS {||Off_Context_Menu()}
        HELPID  NIL
        FLAT    .F.
        TABSTOP .T.
        VISIBLE .T.
        TRANSPARENT .F.
    END BUTTON
END WINDOW
CENTER WINDOW Form_1
ACTIVATE WINDOW Form_1
Return Nil

Function On_Context_Menu(cComponent)
IF IsContextMenuDefined("Form_1") == .T.
   ReleaseContextMenu("Form_1")
ENDIF

Do Case
   Case cComponent="Button_1"
        DEFINE CONTEXT MENU 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 CONTEXT MENU 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="Global"
		DEFINE CONTEXT MENU OF Form_1
			ITEM "Global Form 1" ACTION MsgInfo("Global 1")
			ITEM "Global Form 2" ACTION MsgInfo("Global 2")
        END MENU
Endcase
Return Nil

Function Off_Context_Menu()
IF IsContextMenuDefined("Form_1") == .F.
   Return Nil
ENDIF
ReleaseContextMenu ( "Form_1" )
On_Context_Menu("Global")
Return Nil
I have tested with other components and its returns a error (see image below):
Screen67.PNG
Screen67.PNG (55.51 KiB) Viewed 6476 times

Re: CONTEXT MENU

Posted: Thu Apr 11, 2013 9:29 pm
by srvet_claudio
Pablo César wrote:Now with new implements of ContextMenu options: IsContextMenuDefined and ReleaseContextMenu we can manage diferent ContextMenu. But the problem I did not found the way to run properly with other components. It is working for Button and Form. Please note:

I have tested with other components and its returns a error:
Hi Pablo.
Maybe lack the menu patch viewtopic.php?p=25991#p25991
Best regards,
Claudio.

CONTEXT MENU

Posted: Thu Apr 11, 2013 11:10 pm
by Pablo César
srvet_claudio wrote:Maybe lack the menu patch viewtopic.php?p=25991#p25991
You are right Dr. Soto ! Thank you for your reply and support. I was thinking no patch was necessary in 3.1.2 version. But this patch is mandatory. Is it necessary another patch to be applied (upto now) after release of 3.1.2, Mr. Claudio ? (just for me to know and make reminder to Mr. Rathinagiri for next releases).

My report about this test was quite successfull in most of all components except which one (see in red color) there is not ONGOTFOCUS and ONLOSTFOCUS as events. So please note components list below which are working properly:
[tr][td]Components[/td][td]HMG[/td][td]MiniGUI[/td][/tr]
[tr][td]Button[/td][td]Yes[/td][td]Yes[/td][/tr]
[tr][td]Check[/td][td]Yes[/td][td]Yes[/td][/tr]
[tr][td]List[/td][td]Yes[/td][td]Yes[/td][/tr]
[tr][td]Combo[/td][td]Yes[/td][td]Yes[/td][/tr]
[tr][td]CheckBtn[/td][td]Yes[/td][td]Yes[/td][/tr]
[tr][td]Grid[/td][td]Yes[/td][td]Yes[/td][/tr]
[tr][td]Label[/td][td]No[/td][td]Yes[/td][/tr]
[tr][td]Slider[/td][td]No[/td][td]Yes[/td][/tr]
[tr][td]Image[/td][td]No[/td][td]Yes[/td][/tr]
[tr][td]RadioGroup[/td][td]No[/td][td]Yes[/td][/tr]
[tr][td]Tab[/td][td]No[/td][td]Yes[/td][/tr]
[tr][td]ProgressBar[/td][td]No[/td][td]Yes[/td][/tr]
[tr][td]ToolBar[/td][td]No[/td][td]Yes[/td][/tr]
[tr][td]StatusBar[/td][td]No[/td][td]Yes[/td][/tr]
[tr][td]Spinner[/td][td]No[/td][td]Yes[/td][/tr][/table]

Please also note source code for this test:
CONTEXTMENU.rar
(5.23 KiB) Downloaded 432 times
TextBox, Spinner and EditBox, MenuContext are not the same which are declared. It is Windows default options.

Re: CONTEXT MENU

Posted: Tue May 28, 2013 6:34 pm
by mol
Fine solution for small apps. But, It will be hard to do it with huge projects in this way.

Thanks for sharing!

Marek

Re: CONTEXT MENU

Posted: Wed May 29, 2013 11:48 pm
by srvet_claudio
Hi guys,
I implemented:

Code: Select all

      - DEFINE CONTROL CONTEXT MENU <cControlName> [ OF | PARENT <cParentName> ]
      - DEFINE CONTROL CONTEXTMENU  <cControlName> [ OF | PARENT <cParentName> ]
 
      - RELEASE CONTROL CONTEXT MENU <cControlName>   OF | PARENT <cParentName>
      - RELEASE CONTROL CONTEXTMENU <cControlName>    OF | PARENT<cParentName>

      - ReleaseControlContextMenu ( cControl, cParentForm )
      - IsControlContextMenuDefined ( cControl, cParentForm ) --> Return lBoolean
   
      - SET CONTROL CONTEXTMENU  [ ON | OFF ]
      - SET CONTROL CONTEXT MENU [ ON | OFF ]
Best Regards,
Claudio.