RightClick event in a Browse Control
Moderator: Rathinagiri
-
- Posts: 273
- Joined: Sat May 18, 2019 2:11 pm
- DBs Used: Visual FoxPro, FoxPro
- Location: United States of America
RightClick event in a Browse Control
I very much appreciate all the help forum members have kindly given in the past! I really need some help with a particular problem.
Background:
I have a modal Form. On it is a Tab control that has two Pages. On Page2 there is a Browse control displaying a .DBF. Thus, the hierarchy is:
Window (MyForm)
Tab (MyTab)
Page #1 (PageItems)
Page #2 (PageStates)
Browse (BrowseStates)
Problem: I need the browse’s column #1 cell (of the row) to be changed on a right-click.
However, HMG’s Browse does not have a built-in RightClick event.
In folder “C:\HMG.3.4.4\SAMPLES\Controls\Grid\Grid_Context_Menu\” there is one right-click code sample. Unfortunately I am not successfully adapting this code for the following reasons:
1) This sample uses a “Grid” control (instead of a “Browse”).
2) these rows are populated by an ARRAY rather than directly by a .DBF table.
3) My Browse (and its cells) are nested multiple layers beneath the window.
Questions:
How can I capture a right-click in such a nested Browse of a .DBF? Is there a more appropriate sample?
What is the syntax I’d use to change the value of a right-clicked Browse cell. Or, do I need to change the field value in the .DBF record.
Thank you your guidance and suggestions.
Regards,
Red2
=========== Google into Spanish:
¡Aprecio mucho toda la ayuda que los miembros del foro han brindado amablemente en el pasado! Realmente necesito ayuda con un problema en particular.
Antecedentes:
Tengo un formulario modal. En él hay un control Tab que tiene dos páginas. En la página 2 hay un control Examinar que muestra un archivo .DBF. Por lo tanto, la jerarquía es:
Ventana (MyForm)
Pestaña (MyTab)
Página # 1 (PageItems)
Página # 2 (Estados de página)
Navegar (BrowseStates)
Problema: necesito cambiar la celda de la columna n. ° 1 de exploración (de la fila) con un clic derecho.
Sin embargo, la exploración de HMG no tiene un evento RightClick incorporado.
En la carpeta "C:\HMG.3.4.4\SAMPLES\Controls\Grid\Grid_Context_Menu\" hay una muestra de código de clic derecho. Lamentablemente, no estoy adaptando con éxito este código por los siguientes motivos:
1) Esta muestra utiliza un control "Grid" (en lugar de un "Examinar").
2) estas filas están pobladas por un ARRAY en lugar de directamente por una tabla .DBF.
3) Mi exploración (y sus celdas) están anidadas en varias capas debajo de la ventana.
Preguntas:
¿Cómo puedo capturar un clic derecho en una exploración anidada de un .DBF? ¿Hay una muestra más apropiada?
¿Cuál es la sintaxis que usaría para cambiar el valor de una celda Examinar con el botón derecho? O, ¿necesito cambiar el valor del campo en el registro .DBF.
Gracias por su orientación y sugerencias.
Background:
I have a modal Form. On it is a Tab control that has two Pages. On Page2 there is a Browse control displaying a .DBF. Thus, the hierarchy is:
Window (MyForm)
Tab (MyTab)
Page #1 (PageItems)
Page #2 (PageStates)
Browse (BrowseStates)
Problem: I need the browse’s column #1 cell (of the row) to be changed on a right-click.
However, HMG’s Browse does not have a built-in RightClick event.
In folder “C:\HMG.3.4.4\SAMPLES\Controls\Grid\Grid_Context_Menu\” there is one right-click code sample. Unfortunately I am not successfully adapting this code for the following reasons:
1) This sample uses a “Grid” control (instead of a “Browse”).
2) these rows are populated by an ARRAY rather than directly by a .DBF table.
3) My Browse (and its cells) are nested multiple layers beneath the window.
Questions:
How can I capture a right-click in such a nested Browse of a .DBF? Is there a more appropriate sample?
What is the syntax I’d use to change the value of a right-clicked Browse cell. Or, do I need to change the field value in the .DBF record.
Thank you your guidance and suggestions.
Regards,
Red2
=========== Google into Spanish:
¡Aprecio mucho toda la ayuda que los miembros del foro han brindado amablemente en el pasado! Realmente necesito ayuda con un problema en particular.
Antecedentes:
Tengo un formulario modal. En él hay un control Tab que tiene dos páginas. En la página 2 hay un control Examinar que muestra un archivo .DBF. Por lo tanto, la jerarquía es:
Ventana (MyForm)
Pestaña (MyTab)
Página # 1 (PageItems)
Página # 2 (Estados de página)
Navegar (BrowseStates)
Problema: necesito cambiar la celda de la columna n. ° 1 de exploración (de la fila) con un clic derecho.
Sin embargo, la exploración de HMG no tiene un evento RightClick incorporado.
En la carpeta "C:\HMG.3.4.4\SAMPLES\Controls\Grid\Grid_Context_Menu\" hay una muestra de código de clic derecho. Lamentablemente, no estoy adaptando con éxito este código por los siguientes motivos:
1) Esta muestra utiliza un control "Grid" (en lugar de un "Examinar").
2) estas filas están pobladas por un ARRAY en lugar de directamente por una tabla .DBF.
3) Mi exploración (y sus celdas) están anidadas en varias capas debajo de la ventana.
Preguntas:
¿Cómo puedo capturar un clic derecho en una exploración anidada de un .DBF? ¿Hay una muestra más apropiada?
¿Cuál es la sintaxis que usaría para cambiar el valor de una celda Examinar con el botón derecho? O, ¿necesito cambiar el valor del campo en el registro .DBF.
Gracias por su orientación y sugerencias.
- dragancesu
- Posts: 921
- Joined: Mon Jun 24, 2013 11:53 am
- DBs Used: DBF, MySQL, Oracle
- Location: Subotica, Serbia
Re: RightClick event in a Browse Control
Try c:\hmg344\SAMPLES\Controls\MenuContext\Problem: I need the browse’s column #1 cell (of the row) to be changed on a right-click.
However, HMG’s Browse does not have a built-in RightClick event.
just add after BROWSE definition
Code: Select all
DEFINE CONTEXT MENU
ITEM "Global Form 1" ACTION MsgInfo("Global 1")
ITEM "Global Form 2" ACTION MsgInfo("Global 2")
END MENU
- AUGE_OHR
- Posts: 2062
- Joined: Sun Aug 25, 2019 3:12 pm
- DBs Used: DBF, PostgreSQL, MySQL, SQLite
- Location: Hamburg, Germany
Re: RightClick event in a Browse Control
hi,
BROWSE is a GRID
right-click only work with CONTTEXT MENU
your "Action" is the same like DblClick so what is your Problem
BROWSE is a GRID
right-click only work with CONTTEXT MENU
your "Action" is the same like DblClick so what is your Problem
Code: Select all
PROCEDURE DoIt( cForm, cObj )
...
#IFDEF MultiTag
aItem := GetProperty( "WinLeft", cGrid_Left, "Value" )
#ELSE
nItem := GetProperty( "WinLeft", cGrid_Left, "Value" )
#ENDIF
// get Value of CELL
cText := GetProperty( cForm, cObj, "CELL", nItem, F_NAME )
cAttr := GetProperty( cForm, cObj, "CELL", nItem, F_ATTR )
have fun
Jimmy
Jimmy
-
- Posts: 273
- Joined: Sat May 18, 2019 2:11 pm
- DBs Used: Visual FoxPro, FoxPro
- Location: United States of America
Re: RightClick event in a Browse Control
Hi Dragancesu and Jimmy,
Thank you for your prompt and helpful replies! I will dig into your suggestions and I believe that I'll now get this worked out.
My biggest problem is that, while I have years of Visual FoxPro experience, I only jumped into HMG last year with zero "Harbour" background. "CONTEXT MENU" has no meaning in VFP and the HMG help file only says "Creates a Context Menu definition". OK but what may be clear or simple to decades-experienced Harbour programmers can be quite a steep learning curve to Harbour newbies like me.
BEGIN RANT: With no previous Harbour experience I find HMG documentation to be fragmented, very incomplete, and typically with poor or zero explanation! The same often applies to sample code. END RANT Thank goodness for the HMG forum's generosity!!!
Thanks to your kind "Harbour/HMG" guidance and suggestions I trust that I'll now successfully create a "RightClick" alternative.
Than you again for your generous help! I really appreciate it!
Thank you for your prompt and helpful replies! I will dig into your suggestions and I believe that I'll now get this worked out.
My biggest problem is that, while I have years of Visual FoxPro experience, I only jumped into HMG last year with zero "Harbour" background. "CONTEXT MENU" has no meaning in VFP and the HMG help file only says "Creates a Context Menu definition". OK but what may be clear or simple to decades-experienced Harbour programmers can be quite a steep learning curve to Harbour newbies like me.
BEGIN RANT: With no previous Harbour experience I find HMG documentation to be fragmented, very incomplete, and typically with poor or zero explanation! The same often applies to sample code. END RANT Thank goodness for the HMG forum's generosity!!!
Thanks to your kind "Harbour/HMG" guidance and suggestions I trust that I'll now successfully create a "RightClick" alternative.
Than you again for your generous help! I really appreciate it!
-
- Posts: 273
- Joined: Sat May 18, 2019 2:11 pm
- DBs Used: Visual FoxPro, FoxPro
- Location: United States of America
Re: RightClick event in a Browse Control
Thank you all for your kind help. I find a problem using "CONTEXT MENU" for Right-Click ACTION in a BROWSE.
My Right-Click "CONTEXT MENU" is relevant (only) for my TAB's Page #2!
However, this activity also happens on Page #1 where it is NOT relevant.
QUESTION: Is it possible to ISOLATE my Right-Click "CONTEXT MENU" to Page #2 only?
I would greatly appreciate any thoughts and suggestions. Thanks again!
Red2
My Right-Click "CONTEXT MENU" is relevant (only) for my TAB's Page #2!
However, this activity also happens on Page #1 where it is NOT relevant.
QUESTION: Is it possible to ISOLATE my Right-Click "CONTEXT MENU" to Page #2 only?
I would greatly appreciate any thoughts and suggestions. Thanks again!
Red2
Code: Select all
DEFINE TAB
PAGE "Items" // Page #1
DEFINE BROWSE BrowseItems
...
END BROWSE
END PAGE // Page #1
PAGE "States" // Page #2
DEFINE BROWSE BrowseStates
...
END BROWSE
DEFINE CONTEXT MENU // <--- Relevant ONLY for Page #2!
ITEM "Print this State" ACTION ToPrintToggle( .T.)
ITEM "Do NOT Print this State" ACTION ToPrintToggle( .F. )
END MENU
END PAGE // Page #2
END TAB
- AUGE_OHR
- Posts: 2062
- Joined: Sun Aug 25, 2019 3:12 pm
- DBs Used: DBF, PostgreSQL, MySQL, SQLite
- Location: Hamburg, Germany
Re: RightClick event in a Browse Control
what about (guess your Form call Win1)Red2 wrote: ↑Thu Jul 02, 2020 12:41 pmCode: Select all
DEFINE TAB DEFINE CONTEXT MENU // <--- Relevant ONLY for Page #2! END PAGE // Page #2 END TAB
Code: Select all
DEFINE CONTEXT MENU of Win1.Tab(1)
have fun
Jimmy
Jimmy
-
- Posts: 273
- Joined: Sat May 18, 2019 2:11 pm
- DBs Used: Visual FoxPro, FoxPro
- Location: United States of America
Re: RightClick event in a Browse Control
Hi Jimmy and thank you for your kind suggestion.
I need the RightClick's action to be bound to (isolated to) the BROWSE in TAB #2.
To the form's "DEFINE CONTEXT MENU" I tried adding both:
of DataBrowse.Tab(2) (the form/window name)
and
of ThisWindow.Tab(2)
Both compile into an .EXE. But when I click to bring up the modal form:
Shouldn't it be possible for a RightClick action to be bound to a specific BROWSE???
If anyone has suggestions I would really appreciate hearing them. I'm stuck.
Thanks again,
Red2
I need the RightClick's action to be bound to (isolated to) the BROWSE in TAB #2.
To the form's "DEFINE CONTEXT MENU" I tried adding both:
of DataBrowse.Tab(2) (the form/window name)
and
of ThisWindow.Tab(2)
Both compile into an .EXE. But when I click to bring up the modal form:
Shouldn't it be possible for a RightClick action to be bound to a specific BROWSE???
If anyone has suggestions I would really appreciate hearing them. I'm stuck.
Thanks again,
Red2
Re: RightClick event in a Browse Control
Shouldn't it be possible for a RightClick action to be bound to a specific BROWSE???
HMG/3.4.4/DOC/data/index.htm
DEFINE CONTROL CONTEXT MENU
Add a Context Menu to a Control
Standard Syntax (xBase Style):
DEFINE CONTROL CONTEXT MENU <ControlName> [ OF <ParentWindowName> ]
MENUITEM <cItemCaption>
ACTION <ActionProvedureName> | <bBlock>
[ NAME <MenuItemName>]
[ IMAGE <cImageName> ]
[ CHECKED ]
[ NOTRANSPARENT ]
[ TOOLTIP <cToolTipText> ]
...
...
[ SEPARATOR ]
...
...
END MENU
Ejemplo con GRID / Example with GRID
Code: Select all
DEFINE WINDOW Form_GridCtes AT 0 , 0 WIDTH 1024 HEIGHT 600 TITLE '| ABC CLIENTES |' NOSIZE NOMAXIMIZE ON RELEASE ( SET( _SET_DELETED, .T. ), Form_Main.Restore ) BACKCOLOR { 0, 33, 38 }
aColWhen[ 1 ] := { | | .F. } // El primer campo es READONLY
@ 030 , 005 GRID Grid_2 OF Form_GridCtes WIDTH 1008 HEIGHT 505 FONT "Consolas" SIZE 11 FONTCOLOR BLACK VIRTUAL ;
ROWSOURCE "Ctes" VALUE { 1, 2 } WIDTHS aLong HEADERS aCpos1 COLUMNFIELDS aCpos2 COLUMNCONTROLS aColCtrls
COLUMNWHEN aColWhen ;
ON HEADCLICK { { || Ctes->( DBSetOrder( 1 ), DoMethod( 'Form_GridCtes', "Grid_2", "Refresh", .T. ) ) }, ;
{ || Ctes->( DBSetOrder( 2 ), DoMethod( 'Form_GridCtes', "Grid_2", "Refresh", .T. ) ) } } ;
ALLOWAPPEND ALLOWDELETE EDIT EDITOPTION GRID_EDIT_INSERTBLANK ;
DYNAMICBACKCOLOR afColor
DEFINE CONTROL CONTEXT MENU Grid_2 OF Form_GridCtes
MENUITEM "Borrar/Recuperar este Registro" ACTION OnDeleteGrid( )
MENUITEM "Añadir un Registro" ACTION OnInsertGrid( )
END MENU
Andrés González López
Desde Guadalajara, Jalisco. México.
Desde Guadalajara, Jalisco. México.
-
- Posts: 273
- Joined: Sat May 18, 2019 2:11 pm
- DBs Used: Visual FoxPro, FoxPro
- Location: United States of America
Re: RightClick event in a Browse Control
Hola andyglezl
Muchas gracias por su amable y experta orientación. ¡Buenas noticias! Usando su sugerencia, creo que RightClick ahora está aislado del control TAB Page # 2 BROWSE (solo). Haré pruebas adicionales el lunes, pero parece estar funcionando perfectamente.
Me llevó algo de tiempo transferir los conceptos "C: \ HMG.3.4.4 \ SAMPLES \ Controls \ MenuContext \ MENU_ControlContext_1 \ Demo.PRG" [/ i] a mi proyecto IDE, pero valió la pena.
¡Gracias de nuevo! La generosa ayuda de todos ha sido muy apreciada.
Red2
------------------------------------------------
Hi andyglezl,
Thank you so much for your very kind and expert guidance. Good news! Using your suggestion I believe that the RightClick is now isolated to the TAB Page #2 BROWSE control (only). I'll do additional testing on Monday but it seems to be working perfectly.
It took me some time to transfer the "C:\HMG.3.4.4\SAMPLES\Controls\MenuContext\MENU_ControlContext_1\Demo.PRG" concepts into my IDE project but it was worth it.
Thank you again! Everyone's generous help has been greatly appreciated.
Red2
Muchas gracias por su amable y experta orientación. ¡Buenas noticias! Usando su sugerencia, creo que RightClick ahora está aislado del control TAB Page # 2 BROWSE (solo). Haré pruebas adicionales el lunes, pero parece estar funcionando perfectamente.
Me llevó algo de tiempo transferir los conceptos "C: \ HMG.3.4.4 \ SAMPLES \ Controls \ MenuContext \ MENU_ControlContext_1 \ Demo.PRG" [/ i] a mi proyecto IDE, pero valió la pena.
¡Gracias de nuevo! La generosa ayuda de todos ha sido muy apreciada.
Red2
------------------------------------------------
Hi andyglezl,
Thank you so much for your very kind and expert guidance. Good news! Using your suggestion I believe that the RightClick is now isolated to the TAB Page #2 BROWSE control (only). I'll do additional testing on Monday but it seems to be working perfectly.
It took me some time to transfer the "C:\HMG.3.4.4\SAMPLES\Controls\MenuContext\MENU_ControlContext_1\Demo.PRG" concepts into my IDE project but it was worth it.
Thank you again! Everyone's generous help has been greatly appreciated.
Red2
- salamandra
- Posts: 311
- Joined: Thu Jul 31, 2008 8:33 pm
- DBs Used: DBF, MySQL, SQL
- Location: Brazil
Re: RightClick event in a Browse Control
Hi @Red2,
Please, take a look at the attached sample.
It has a Tab Control (3 pages) with a Browse (not Grid) in Page 2 and Context menu just for Browse.
Best regards,
Salamandra, Brazil
Please, take a look at the attached sample.
It has a Tab Control (3 pages) with a Browse (not Grid) in Page 2 and Context menu just for Browse.
Best regards,
Salamandra, Brazil
- Attachments
-
- test.rar
- (2.01 MiB) Downloaded 188 times
There is one time in which is crucial awakening. That time is now. ( Buddha )