use FMG more than once
Moderator: Rathinagiri
Re: use FMG more than once
mmmm...
Senti curiosidad por el manejo de las formas FMG y me puse a la tarea de ver como funcionaban.
Pero resulta que como nunca las había manejado, no sabía de donde salian, y veo que el IDE de HMG
las genera, pero como tampoco nunca he manejado el IDE, pues quede en las mismas.
Tomando como base el ejemplo compartido por EDK, (Gracias !)
( https://www.hmgforum.com/viewtopic.php? ... 105#p60105 )
empece a programarlo de la forma en que yo lo se hacer y pues esto resulto.
P.D. Tengo el problema de que al dar doble click en el GRID, deja de funcionar el ratón en el mismo GRID.
Si señalo con el ratón y oprimo la tecla ENTER, si funciona bien.
(Se tratara de un bug ?)
A ver si alguien le encuentra solución y nos la comparte.
*------------------------------------------------------------------------------
mmm...
I was curious about the handling of FMG forms and I
put the task to see how they worked.
But it turns out that since I had never handled them, I didn't know where they came from, and I see that the HMG
IDE generates them, but neither have I ever managed the IDE, then stay in them.
Based on the example shared by EDK, (Thanks !)
( https://www.hmgforum.com/viewtopic.php? ... 105#p60105 )
I started to program it the way I know how to do it, and this resulted.
P.S. I have the problem that by double clicking on the GRID,
the mouse stops working on the same GRID.
If I point the mouse and press the ENTER key, it works fine.
(Is it a bug?)
Let's see if someone finds a solution and shares it with us.
Senti curiosidad por el manejo de las formas FMG y me puse a la tarea de ver como funcionaban.
Pero resulta que como nunca las había manejado, no sabía de donde salian, y veo que el IDE de HMG
las genera, pero como tampoco nunca he manejado el IDE, pues quede en las mismas.
Tomando como base el ejemplo compartido por EDK, (Gracias !)
( https://www.hmgforum.com/viewtopic.php? ... 105#p60105 )
empece a programarlo de la forma en que yo lo se hacer y pues esto resulto.
P.D. Tengo el problema de que al dar doble click en el GRID, deja de funcionar el ratón en el mismo GRID.
Si señalo con el ratón y oprimo la tecla ENTER, si funciona bien.
(Se tratara de un bug ?)
A ver si alguien le encuentra solución y nos la comparte.
*------------------------------------------------------------------------------
mmm...
I was curious about the handling of FMG forms and I
put the task to see how they worked.
But it turns out that since I had never handled them, I didn't know where they came from, and I see that the HMG
IDE generates them, but neither have I ever managed the IDE, then stay in them.
Based on the example shared by EDK, (Thanks !)
( https://www.hmgforum.com/viewtopic.php? ... 105#p60105 )
I started to program it the way I know how to do it, and this resulted.
P.S. I have the problem that by double clicking on the GRID,
the mouse stops working on the same GRID.
If I point the mouse and press the ENTER key, it works fine.
(Is it a bug?)
Let's see if someone finds a solution and shares it with us.
Andrés González López
Desde Guadalajara, Jalisco. México.
Desde Guadalajara, Jalisco. México.
- serge_girard
- Posts: 3166
- Joined: Sun Nov 25, 2012 2:44 pm
- DBs Used: 1 MySQL - MariaDB
2 DBF - Location: Belgium
- Contact:
Re: use FMG more than once
Andrés,
Serge
I sometimes have the same problem and can not find cause and solution. I live with it....P.S. I have the problem that by double clicking on the GRID,
the mouse stops working on the same GRID.
If I point the mouse and press the ENTER key, it works fine.
Serge
There's nothing you can do that can't be done...
- AUGE_OHR
- Posts: 2062
- Joined: Sun Aug 25, 2019 3:12 pm
- DBs Used: DBF, PostgreSQL, MySQL, SQLite
- Location: Hamburg, Germany
Re: use FMG more than once
hi,
i have play with your Sample an include some Textbox.
i play with your Array and can "load" from Array an "store" it to Textbox this Way
now the opposite is need to "write-back" but again i got Problem with Syntax
please have a look into Attachment, Thx
---
ok have fix it with direct write into Array and Refresh Grid
all seems to work ... but Refresh does not show change but i can see it in Debugger that aRows have change it
so why Refresh does not work ... is there a RefreshALL or do i need some Parameter
attached Sample have fun
YES, that is the Way i'm searching while User want more than SDI like Cl*pper
i have play with your Sample an include some Textbox.
i play with your Array and can "load" from Array an "store" it to Textbox this Way
Code: Select all
PROCEDURE DoStoreData(ChildForm)
LOCAL nRow := Getproperty("FormMain", "Grid_1", "CellRowFocused")
LOCAL cText1,cText2,cText3
cText1 := GetProperty( "FormMain","Grid_1", "Cell", nRow, 1 )
cText2 := GetProperty( "FormMain","Grid_1", "Cell", nRow, 2 )
cText3 := GetProperty( "FormMain","Grid_1", "Cell", nRow, 3 )
SetProperty( ChildForm, "TEXT_1", "Value", cText1 )
SetProperty( ChildForm, "TEXT_2", "Value", cText2 )
SetProperty( ChildForm, "TEXT_3", "Value", cText3 )
RETURN
Code: Select all
PROCEDURE DoReplaceData(ChildForm,nID)
LOCAL nRow := nID
LOCAL cText1,cText2,cText3
cText1 := GetProperty( ChildForm, "TEXT_1", "Value" )
cText2 := GetProperty( ChildForm, "TEXT_2", "Value" )
cText3 := GetProperty( ChildForm, "TEXT_3", "Value" )
ALTD()
// how is the right Syntax
SetProperty( "FormMain","Grid_1", "Cell", nRow, 1, cText1)
SetProperty( "FormMain","Grid_1", "Cell", nRow, 2, cText2)
SetProperty( "FormMain","Grid_1", "Cell", nRow, 3, cText3)
FormMain.Grid_1.refresh
RETURN
---
ok have fix it with direct write into Array and Refresh Grid
Code: Select all
// update Array direct
aRows[nRow][1] := cText1
aRows[nRow][2] := cText2
aRows[nRow][3] := cText3
FormMain.Grid_1.refresh
attached Sample have fun
have fun
Jimmy
Jimmy
Re: use FMG more than once
Change :
// update Array direct
* aRows[nRow][1] := cText1
* aRows[nRow][2] := cText2
* aRows[nRow][3] := cText3
FormMain.Grid_1.Cell( nID , 1 ) := cText1
FormMain.Grid_1.Cell( nID , 2 ) := cText2
FormMain.Grid_1.Cell( nID , 3 ) := cText3
or
FormMain.Grid_1.Cell( nID , 1 ) := GetProperty( ChildForm, "TEXT_1", "Value" )
FormMain.Grid_1.Cell( nID , 2 ) := GetProperty( ChildForm, "TEXT_2", "Value" )
FormMain.Grid_1.Cell( nID , 3 ) := GetProperty( ChildForm, "TEXT_3", "Value" )
// update Array direct
* aRows[nRow][1] := cText1
* aRows[nRow][2] := cText2
* aRows[nRow][3] := cText3
FormMain.Grid_1.Cell( nID , 1 ) := cText1
FormMain.Grid_1.Cell( nID , 2 ) := cText2
FormMain.Grid_1.Cell( nID , 3 ) := cText3
or
FormMain.Grid_1.Cell( nID , 1 ) := GetProperty( ChildForm, "TEXT_1", "Value" )
FormMain.Grid_1.Cell( nID , 2 ) := GetProperty( ChildForm, "TEXT_2", "Value" )
FormMain.Grid_1.Cell( nID , 3 ) := GetProperty( ChildForm, "TEXT_3", "Value" )
Andrés González López
Desde Guadalajara, Jalisco. México.
Desde Guadalajara, Jalisco. México.
- AUGE_OHR
- Posts: 2062
- Joined: Sun Aug 25, 2019 3:12 pm
- DBs Used: DBF, PostgreSQL, MySQL, SQLite
- Location: Hamburg, Germany
Re: use FMG more than once
OK, that work , THXandyglezl wrote: ↑Thu Nov 28, 2019 3:21 am Change :orCode: Select all
FormMain.Grid_1.Cell( nID , 1 ) := cText1 FormMain.Grid_1.Cell( nID , 2 ) := cText2 FormMain.Grid_1.Cell( nID , 3 ) := cText3
Code: Select all
FormMain.Grid_1.Cell( nID , 1 ) := GetProperty( ChildForm, "TEXT_1", "Value" ) FormMain.Grid_1.Cell( nID , 2 ) := GetProperty( ChildForm, "TEXT_2", "Value" ) FormMain.Grid_1.Cell( nID , 3 ) := GetProperty( ChildForm, "TEXT_3", "Value" )
but i still wonder why Refresh does not work
p.s. how to set Color for one Cell
have fun
Jimmy
Jimmy
Re: use FMG more than once
Alguna idea de porque no se pueden abrir varias ventanas con un FOR-NEXT ?
Tengo que cerrar cada una de ellas para que se pueda abrir la siguiente...
*----------------------------------------------------------------------------------------------
Any idea why you can't open several windows with a FOR-NEXT?
I have to close each of them so that the next one can be opened ...
Tengo que cerrar cada una de ellas para que se pueda abrir la siguiente...
*----------------------------------------------------------------------------------------------
Any idea why you can't open several windows with a FOR-NEXT?
I have to close each of them so that the next one can be opened ...
Code: Select all
****************************************************************
FUNCTION MultiWin( nCol )
aNombMulti := { 2, 4, 6, 8 }
FOR i1 = 1 TO HMG_LEN( aNombMulti )
ChildForm( aNombMulti[i1] )
*MSGDEBUG( aNombMulti, aNombMulti[i1] )
NEXT
RETURN
***************************************************************************
Code: Select all
//[•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•]
//¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
// * Ejemplo de Multiventanas CHILD desde un GRID hecho por AndyGlezL (Andrés González López) 26/NOV/2019
// * Tomado del Ejemplo compartido por EDK. https://www.hmgforum.com/viewtopic.php?f=12&t=6209&p=60105#p60105
// * ---------------------------------------------------------------------------------------------------
// * Example of CHILD Multiwindows from a GRID made by AndyGlezL (Andrés González López) 26/NOV/2019
// * Taken from the Example shared by EDK. https://www.hmgforum.com/viewtopic.php?f=12&t=6209&p=60105#p60105
// * ---------------------------------------------------------------------------------------------------
// * E-mail: andyglezl@hotmail.com - dari_disenos@hotmail.com
// * http://daridisenos.wix.com/dariweb
// * Desarrollado en HMG 3.4.4 VIVA HMG !!!
//_______________________________________________________________________________________________________
//[•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•.•]
//¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
#include <hmg.ch>
#define fColor { || if ( This.CellRowIndex/2 == int(This.CellRowIndex/2) , WHITE , { 235, 245, 245 } ) }
#xtranslate _HMG_aFormNames => _HMG_SYSDATA\[66\]
FUNCTION Main()
PUBLIC nForm := 1
PUBLIC aRows [20] [3]
aRows [1] := {'Simpson','Homer','555-5555'}
aRows [2] := {'Mulder','Fox','324-6432'}
aRows [3] := {'Smart','Max','432-5892'}
aRows [4] := {'Grillo','Pepe','894-2332'}
aRows [5] := {'Kirk','James','346-9873'}
aRows [6] := {'Barriga','Carlos','394-9654'}
aRows [7] := {'Flanders','Ned','435-3211'}
aRows [8] := {'Smith','John','123-1234'}
aRows [9] := {'Pedemonti','Flavio','000-0000'}
aRows [10] := {'Gomez','Juan','583-4832'}
aRows [11] := {'Fernandez','Raul','321-4332'}
aRows [12] := {'Borges','Javier','326-9430'}
aRows [13] := {'Alvarez','Alberto','543-7898'}
aRows [14] := {'Gonzalez','Ambo','437-8473'}
aRows [15] := {'Batistuta','Gol','485-2843'}
aRows [16] := {'Vinazzi','Amigo','394-5983'}
aRows [17] := {'Pedemonti','Flavio','534-7984'}
aRows [18] := {'Samarbide','Armando','854-7873'}
aRows [19] := {'Pradon','Alejandra','???-????'}
aRows [20] := {'Reyes','Monica','432-5836'}
DEFINE WINDOW FormMain AT 0 , 0 WIDTH GetDesktopWidth() HEIGHT GetDesktopHeight()-5 NOSIZE MAIN BACKCOLOR { 230 , 230 , 250 }
DEFINE MAIN MENU
DEFINE POPUP "Menu"
MENUITEM "Open several Windows" ACTION MultiWin()
MENUITEM "Exit" ACTION ReleaseAllForms()
END POPUP
END MENU
@ 010,010 GRID Grid_1 OF FormMain WIDTH 450 HEIGHT 600 ITEMS aRows FONT "Verdana" SIZE 10 HEADERS { 'Last Name', 'First Name', 'Phone' } WIDTHS { 140 , 140 , 140 } ;
VALUE 1 DYNAMICBACKCOLOR { fColor, fColor, fColor } ON DBLCLICK ( ChildForm( GetProperty( "FormMain","Grid_1", "Value" ) ) ) ;
TOOLTIP "DblClick para Abrir" JUSTIFY { GRID_JTFY_CENTER, GRID_JTFY_RIGHT, GRID_JTFY_RIGHT }
FOR i1=1 TO 3 // Colores al ENCABEZADO de las 3 Columnas
SetProperty( "FormMain", "Grid_1", "HeaderDYNAMICFONT", i1, { || ARRAY FONT "Consolas" SIZE 12 ITALIC BOLD } )
SetProperty( "FormMain", "Grid_1", "HeaderDYNAMICFORECOLOR", i1, { || { 100 , 149 , 237 } } )
NEXT
CellNavigationColor( _SELECTEDROW_FORECOLOR, WHITE ) ; CellNavigationColor( _SELECTEDROW_BACKCOLOR, BLUE ) // Renglon seleccionado
END WINDOW
ACTIVATE WINDOW FormMain
RETURN
***************************************************************************
FUNCTION ReleaseAllForms()
LOCAL i
FOR i = Len( _HMG_aFormNames ) TO 1 STEP -1 // Ir cerrando las ventanas de la última a la primera
IF IsWindowDefined( &( _HMG_aFormNames [i] ) )
DoMethod( _HMG_aFormNames [i], "Release")
ENDIF
NEXT i
RETURN
**************************************************************************
FUNCTION ChildForm( nIndexRow )
LOCAL ChildForm :="ChildForm_", i
cNombre := GetProperty( "FormMain","Grid_1", "Cell", nIndexRow, 1 ) + " " + ;
GetProperty( "FormMain","Grid_1", "Cell", nIndexRow, 2 ) + " " + ;
GetProperty( "FormMain","Grid_1", "Cell", nIndexRow, 3 )
ChildForm := hb_StrReplace( cNombre, { ' ' => '', '-' => '', '?' => '' } ) // Dejo ChildForm sin espacios o carateres "raros"
IF ! IsWindowDefined( &( ChildForm ) )
DEFINE WINDOW &ChildForm AT 0 , 0 WIDTH 550 HEIGHT 350 CHILD NOSIZE NOMINIMIZE NOMAXIMIZE ;
ON INIT DoStoreData(ChildForm)
@ 000 , 000 LABEL Label_1 OF &ChildForm VALUE "Simple context Menu of Grid" WIDTH 550 HEIGHT 20 FONT 'Arial' SIZE 9 CENTERALIGN
SetProperty( ChildForm, "Title", "#" + Alltrim( Str( nForm )+SPACE(15)+cNombre ) )
SetProperty( ChildForm, "Col", 440 + (25 * nForm ) )
SetProperty( ChildForm, "Row", 30 + (25 * nForm ) )
nForm ++
@ 060,125 TEXTBOX TEXT_1 ;
MAXLENGTH 40
@ 090,125 TEXTBOX TEXT_2 ;
MAXLENGTH 40
@ 120,125 TEXTBOX TEXT_3 ;
MAXLENGTH 40
@ 150,125 BUTTON SaveButton ;
PARENT ChildForm ;
CAPTION "&Save" ;
WIDTH 40 ;
HEIGHT 40 ;
ONCLICK DoReplaceData(ChildForm,nIndexRow)
END WINDOW
ACTIVATE WINDOW &ChildForm
ELSE
FOR i = 1 TO Len( _HMG_aFormNames )
IF ChildForm = GetProperty( _HMG_aFormNames[i], "Title" )
DoMethod( ChildForm, "SetFocus")
EXIT
ENDIF
NEXT i
ENDIF
RETURN NIL
****************************************************************
PROCEDURE DoStoreData(ChildForm)
LOCAL nRow := Getproperty("FormMain", "Grid_1", "Value")
SetProperty( ChildForm, "TEXT_1", "Value", GetProperty( "FormMain","Grid_1", "Cell", nRow, 1 ) )
SetProperty( ChildForm, "TEXT_2", "Value", GetProperty( "FormMain","Grid_1", "Cell", nRow, 2 ) )
SetProperty( ChildForm, "TEXT_3", "Value", GetProperty( "FormMain","Grid_1", "Cell", nRow, 3 ) )
RETURN
****************************************************************
PROCEDURE DoReplaceData(ChildForm,nID)
FormMain.Grid_1.Cell( nID , 1 ) := GetProperty( ChildForm, "TEXT_1", "Value" )
FormMain.Grid_1.Cell( nID , 2 ) := GetProperty( ChildForm, "TEXT_2", "Value" )
FormMain.Grid_1.Cell( nID , 3 ) := GetProperty( ChildForm, "TEXT_3", "Value" )
FormMain.Grid_1.refresh
DoMethod( ChildForm, "Release")
RETURN
****************************************************************
FUNCTION MultiWin( )
aNombMulti := { 2, 4, 6, 8 }
FOR i1 = 1 TO HMG_LEN( aNombMulti )
ChildForm( aNombMulti[i1] )
*MSGDEBUG( aNombMulti, aNombMulti[i1] )
NEXT
RETURN
***************************************************************************
Andrés González López
Desde Guadalajara, Jalisco. México.
Desde Guadalajara, Jalisco. México.
Re: use FMG more than once
Hola
Seguí "jugando" con esto de los MultiForms...
*---------------------------------------------------------
HI
I kept "playing" with this MultiForms ...
Seguí "jugando" con esto de los MultiForms...
*---------------------------------------------------------
HI
I kept "playing" with this MultiForms ...
Andrés González López
Desde Guadalajara, Jalisco. México.
Desde Guadalajara, Jalisco. México.
Re: use FMG more than once
Confirmado: "Problemas con el Mouse"
Hay "algo" que al crear las ventanas CHILD, queda "desactivado".
Y mientras alguna de ellas quede activa, no lo libera.
(Qué y porqué ? No lo se todavia...)
*----------------------------------------------------------------------------------------------
Confirmed: "Problems with the Mouse"
There is "something" that when creating the CHILD windows, is "disabled".
And as long as one of them is active, it does not release it.
(What and why? I don't know yet...)
*--------------------------------------
Something we can do ?????
Hay "algo" que al crear las ventanas CHILD, queda "desactivado".
Y mientras alguna de ellas quede activa, no lo libera.
(Qué y porqué ? No lo se todavia...)
*----------------------------------------------------------------------------------------------
Confirmed: "Problems with the Mouse"
There is "something" that when creating the CHILD windows, is "disabled".
And as long as one of them is active, it does not release it.
(What and why? I don't know yet...)
Algo que podamos hacer ?????*****************************************************************************************
P.S. I have the problem that by double clicking on the GRID,
(dblclick creates a CHILD window)
the mouse stops working on the same GRID.
*****************************************************************************************
"I sometimes have the same problem and can not find cause and solution. I live with it...."
Serge
*****************************************************************************************
Any idea why you can't open several windows (CHILD) with a FOR-NEXT?
I have to close each of them so that the next one can be opened ...
*****************************************************************************************
*--------------------------------------
Something we can do ?????
Andrés González López
Desde Guadalajara, Jalisco. México.
Desde Guadalajara, Jalisco. México.