CONTEXT MENU

Creative ideas/suggestions for HMG

Moderator: Rathinagiri

User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil
Has thanked: 100 times
Been thanked: 182 times

CONTEXT MENU

Post by Pablo César » Fri Nov 16, 2012 7:06 pm

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.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein

User avatar
Rathinagiri
Posts: 5263
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Has thanked: 169 times
Been thanked: 172 times
Contact:

Post by Rathinagiri » Sat Nov 17, 2012 3:46 am

Yes. It is a nice idea.

'C' Gurus, please come for help.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.

User avatar
bpd2000
Posts: 1078
Joined: Sat Sep 10, 2011 4:07 am
Location: India
Has thanked: 197 times
Been thanked: 96 times

Post by bpd2000 » Sat Nov 17, 2012 9:43 am

I am also eagerly awaiting such extension
BPD
Convert Dream into Reality through HMG

User avatar
danielmaximiliano
Posts: 2142
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Has thanked: 155 times
Been thanked: 23 times
Contact:

Post by danielmaximiliano » Sat Nov 17, 2012 9:52 am

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 3639 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
Attachments
TextCrawler_2012-11-17_06-41-40.jpg
TextCrawler_2012-11-17_06-41-40.jpg (119.5 KiB) Viewed 3598 times
Last edited by danielmaximiliano on Sat Nov 17, 2012 9:23 pm, edited 1 time in total.
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`.HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. : +54901169026142
Telegram Name : DaNiElMaXiMiLiAnO

User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil
Has thanked: 100 times
Been thanked: 182 times

Post by Pablo César » Sat Nov 17, 2012 6:46 pm

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 !!
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein

User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil
Has thanked: 100 times
Been thanked: 182 times

Post by Pablo César » Thu Apr 11, 2013 8:06 pm

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 3272 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 3258 times
Last edited by Pablo César on Thu Apr 11, 2013 11:29 pm, edited 2 times in total.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein

User avatar
srvet_claudio
Posts: 2044
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Has thanked: 35 times
Been thanked: 146 times
Contact:

Post by srvet_claudio » Thu Apr 11, 2013 9:29 pm

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.
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com

User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil
Has thanked: 100 times
Been thanked: 182 times

Post by Pablo César » Thu Apr 11, 2013 11:10 pm

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 238 times
TextBox, Spinner and EditBox, MenuContext are not the same which are declared. It is Windows default options.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein

User avatar
mol
Posts: 3214
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Has thanked: 223 times
Been thanked: 123 times
Contact:

Post by mol » Tue May 28, 2013 6:34 pm

Fine solution for small apps. But, It will be hard to do it with huge projects in this way.

Thanks for sharing!

Marek

User avatar
srvet_claudio
Posts: 2044
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Has thanked: 35 times
Been thanked: 146 times
Contact:

Post by srvet_claudio » Wed May 29, 2013 11:48 pm

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.
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com

Post Reply