Page 2 of 2

Re: GRID in HMG 3.4.4 - Unable to view (edit) MEMO field contents ?

Posted: Wed Jun 14, 2017 7:38 pm
by franco
Here is sample of what I am having trouble with. I am sure I am doing something wrong in 3.4.4.
The DESC text box updates in 3.2 but does not in 3.4.4 on save and refresh in CH Function.
Also I can not remember how to set the curser back to the grid column I left.

Code: Select all

#include "hmg.ch"

Function Main
	FILS()
	set century on
	*IF .NOT. ISWINDOWACTIVE(FORM_2)
		DEFINE WINDOW Form_2 ;
		AT 110, 10 ;			
		WIDTH 1250 ;				
		HEIGHT 700 ;		
		TITLE 'Sales Report Screen' ;			
		MAIN ;
		NOSIZE 	;     
		ON RELEASE {||{Closer2fils()}}  
		
			DEFINE TEXTBOX TEXT_1 	
			ROW 150
			COL 280
			WIDTH 200 
			HEIGHT 20 
			UPPERCASE .T.
			FIELD TEMP5->DESC 
			
		END TEXTBOX

		DEFINE GRID Grid_2
			ROW	200
			COL	30        //140
			WIDTH 1190         //1100
			HEIGHT 200    //370
			BACKCOLOR  { 180, 180, 200}
			FONTCOLOR  { 0, 0, 0 }	
			HEADERS {"Invoice", "Item" ,"Sellprice","Desc"}
			COLUMNCONTROLS { {'TEXTBOX','CHARACTER',"!!!!!!!!"},{'TEXTBOX','CHARACTER',"!!!!!!!!!!!!!!!"},;
							{'TEXTBOX','NUMERIC','9999999.99'},{'TEXTBOX','CHARACTER',"!!!!!!!!!!!!!!!!!!!!!!!!!!"}}
			WIDTHS {80, 95, 100 ,150}
			JUSTIFY {0,0,1,0}
			COLUMNWHEN { { || .T. },{ || .T. }, { || .T. }, { || .T. }}
			ROWSOURCE 'temp5'  
			COLUMNFIELDS { 'INV_NO' , 'ITEM_NO','UNIT_PRICE','DESC'}
			VALUE {1,1}
			ALLOWEDIT .T.
			TABSTOP .F.
			ON CHANGE CH()
		
		END GRID
 
		END WINDOW
		
		
		
		Form_2.Activate
		
	RETURN //NIL
*********************************************************
	Function CH
	local wh := Form_2.Grid_2.value
	Form_2.Grid_2.save
	FORM_2.Text_1.refresh
	form_2.Grid_2.value := wh
	return
	

	Function Fils
		Local CF1 := {}
		CF1 := {}
		aADD(CF1,{'INV_no' , 'C' , 8,0})
		AADD(CF1,{'ITEM_NO', 'C' , 15,0})
		Aadd(CF1,{'DESC',   'C', 26,0})
		Aadd(CF1,{'UNIT_PRICE', 'N' , 10,2})

		if ! hb_dbcreatetemp("temp5", cf1)
			msgbox("Cannot create temporary table: Item")
			RELEASE WINDOW ALL
			return nil
		endif
		if select("temp5") = 0
			use temp5 new
		endif
		select temp5 
		index on inv_no to temp5
		temp := 1
		do while temp < 51
			append blank
			replace inv_no with 'IN'+alltrim(str(temp+1000))
			replace item_no with 'IT'+alltrim(str(temp+100))
			replace unit_price with temp*100
			replace desc with 'DESC '+STR(TEMP)
			temp:=temp+1
			loop
		enddo
		return

	Function CloseR2fils

		close temp5
		release temp5
	
	return
Any thoughts greatly apprieciated... Franco ;)

Re: GRID in HMG 3.4.4 - Unable to view (edit) MEMO field contents ?

Posted: Thu Jun 15, 2017 8:30 am
by Marin
Hi, Franco,

Based on your PRG-fragment I can not formulate your personaly needs exactly, but please read the text below.
You may find it useful.

Regarding "Also I can not remember how to set the curser back to the grid column I left. ".
1. When you set the GRID property CELLNAVIGATION to .T., then you have the ability to get/set the row and column in a grid. In other words, the VALUE property of the GRID-control will return (ROW, COL) coordinates of the current cell in a GRID.
Example:
DEFINE GRID Grid_1
.......
CELLNAVIGATION .T. // Value {x,y} will return (ROW, COL) instead of ROW only

2. In your GRID-control ON CHANGE function:
//* Array to temporary store the (ROW, COL) grid coordinates, where a[1] := ROW, a[2] := COL
LOCAL a := ChildWin_1.Grid_1.VALUE
......
//* Later, you might want to set the (ROW, COL) back in order to return to the same cell in the GRID =>
ChildWin_1.Grid_1.VALUE := { a[1], a[2] }

Regarding "The DESC text box updates in 3.2 but does not in 3.4.4 on save and refresh in CH Function."
1. I would propose you to check whether the GRID.RecNo property corresponds to the DBF->RecNo(). Please, refer to the changelog in hmg3.4.4.

Regards,
Marin

Re: GRID in HMG 3.4.4 - Unable to view (edit) MEMO field contents ?

Posted: Thu Jun 15, 2017 7:22 pm
by franco
Hi Marin, Thanks for resonce.
I have grid cell fixed. Still no text box update, the table is set to eof() not to grid item.
I noticed a post on 3.4.4 by Rathi on mar29/17 says:
NOTE: The RECNO property of the Grid control not changes the current physical record number of the DBF file, only convert between the row
of grid and the recno of the DBF.
- Get Grid.RECNO --> convert Logical record ( grid row ) to Physical record ( DBF recno )
- Set Grid.RECNO := XXX --> convert the Physical record XXX ( recno ) to Logical record ( grid row )
I think this is my problem and am going to try in my save grid function. I do not understand why this was cahnged, must be a reason.
Thanks again, Franco ;)

Re: GRID in HMG 3.4.4 - Unable to view (edit) MEMO field contents ?

Posted: Sat Jan 20, 2018 2:48 pm
by mustafa
Hola Maestro Rathinagiri:
Seria tan amable de facilitar
la misma libreria libhmg.a para
64 Bits
He intentado renombrar la -> libhmg.zip
que Vds. ha puesto , pero al reconstruir
_BuildAllLib64.bat , me está dando Error.

Un Saludo
Mustafa

*----------------------- Google ---------------------*
Hi Master Rathinagiri:
It would be so kind to facilitate
the same libhmg.a library for
64 bits
I tried renaming the -> libhmg.zip
that you have put, but when rebuilding
_BuildAllLib64.bat, is giving me Error.

A greeting
Mustafa

Re: GRID in HMG 3.4.4 - Unable to view (edit) MEMO field contents ?

Posted: Sun Jan 21, 2018 6:40 am
by Rathinagiri
Sure, I shall try.

Re: GRID in HMG 3.4.4 - Unable to view (edit) MEMO field contents ?

Posted: Sun Jan 21, 2018 1:32 pm
by mustafa
Hola Maestro Rathinagiri :
Se me ocurrio revisar todas las versiones anteriores de HMG
y he descubierto que con la versión 3.4.0 de 64 bits una vez recopilada
la libreria antigua con _BuildAllLib64.bat está funcionando
ya se pueden ver los campos Memo en un Grid , lo he probado
con la versión Hmg 3.4.3 64 bits
Pongo en -> "zip" la libreria antigua por si lo quieren probar

Saludos
Mustafa :idea: :lol:
*------------------------------------- Google ----------------------------------*
Hello Master Rathinagiri :
It occurred to me to review all previous versions of HMG
and I discovered that with 64 bits version 3.4.0 once compiled
the old library with _BuildAllLib64.bat is working
You can already see the Memo fields in a Grid, I've tried it
with version Hmg 3.4.3 64 bits
I put in -> "zip" the old library in case they want to try it

Regards
Mustafa :idea: :lol:

Re: GRID in HMG 3.4.4 - Unable to view (edit) MEMO field contents ?

Posted: Wed Mar 10, 2021 8:11 pm
by trmpluym
Rathi,

Great you solved this bug !

Can you tell us what is changed in the source so we can compile our own libhmg.a ?

I ask because the same problem is occurring in HMG 3.4.3. When i know what is changed in the source, maybe I am able to fix the same problem in 3.4.3 myself.

Thanks in advance !

Re: GRID in HMG 3.4.4 - Unable to view (edit) MEMO field contents ?

Posted: Wed Mar 10, 2021 8:32 pm
by trmpluym
Rathi,

Found the solution for 3.4.3

The first part is the same:

1. modify the line number 1133 of \hmg.3.4.4\source\h_grid.prg

Code: Select all

cTextFile:= GetDataGridCellData ( idx , .t. )
into

Code: Select all

cTextFile:= V
2. Recompile libraries with:

c:\hmg.3.4.4\BuildAllLib32.bat

Also do not forget to us Alt + S (File->Save pending session) before leaving the demo.