Alto de las filas de un grid.

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
User avatar
mjaviergutierrez
Posts: 156
Joined: Fri Nov 30, 2012 7:51 pm
DBs Used: DBF
Location: San Lorenzo, Santa Fe, Argentina

Alto de las filas de un grid.

Post by mjaviergutierrez »

Hola Colegas !!
Es posible modificar el alto (height) , de las "filas" (row) de un grid ?? Busque en los post pero no encuentro nada, ó no me doy cuenta ....
Saludos.
...
User avatar
gfilatov
Posts: 1090
Joined: Fri Aug 01, 2008 5:42 am
Location: Ukraine
Contact:

Re: Alto de las filas de un grid.

Post by gfilatov »

mjaviergutierrez wrote: Mon May 13, 2024 9:10 pm Hola Colegas !!
Es posible modificar el alto (height) , de las "filas" (row) de un grid ?? Busque en los post pero no encuentro nada, ó no me doy cuenta ....
Saludos.
Hola,

This is possible with a little trick described in the next post :arrow:

https://hmgforum.com/viewtopic.php?p=35178

Hope it is helpful. :idea:
Kind Regards,
Grigory Filatov

"Everything should be made as simple as possible, but no simpler." Albert Einstein
edk
Posts: 999
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland

Re: Alto de las filas de un grid.

Post by edk »

Using the same trick, I built a function that allows me to adjust the height of grid rows. Using the slider you can increase and decrease the height of the rows.

Code: Select all


#include "hmg.ch"
REQUEST HB_MEMIO

Function Main

Local aRows [20] [4]

	DEFINE WINDOW Form_1 ;
		AT 0,0 ;
		WIDTH 690 ;
		HEIGHT 400 ;
		TITLE 'Changing the height of a grid row.' ;
		MAIN 


		aRows [1]	:= {113.12,date(),1,1 , .t., "1st line" + CRLF + "2nd line" + CRLF + "3rd line" }
		aRows [2]	:= {123.12,date(),2,2 , .f., "1st line" + CRLF + "2nd line" + CRLF + "3rd line" }
		aRows [3]	:= {133.12,date(),3,3, .t., "1st line" + CRLF + "2nd line" + CRLF + "3rd line" }
		aRows [4]	:= {143.12,date(),1,4, .f., "1st line" + CRLF + "2nd line" + CRLF + "3rd line" }
		aRows [5]	:= {153.12,date(),2,5, .t., "1st line" + CRLF + "2nd line" + CRLF + "3rd line" }
		aRows [6]	:= {163.12,date(),3,6, .f., "1st line" + CRLF + "2nd line" + CRLF + "3rd line" }
		aRows [7]	:= {173.12,date(),1,7, .t., "1st line" + CRLF + "2nd line" + CRLF + "3rd line" }
		aRows [8]	:= {183.12,date(),2,8, .f., "1st line" + CRLF + "2nd line" + CRLF + "3rd line" }
		aRows [9]	:= {193.12,date(),3,9, .t., "1st line" + CRLF + "2nd line" + CRLF + "3rd line" }
		aRows [10]	:= {113.12,date(),1,10, .f., "1st line" + CRLF + "2nd line" + CRLF + "3rd line" }
		aRows [11]	:= {123.12,date(),2,11, .t., "1st line" + CRLF + "2nd line" + CRLF + "3rd line" }
		aRows [12]	:= {133.12,date(),3,12, .f., "1st line" + CRLF + "2nd line" + CRLF + "3rd line" }
		aRows [13]	:= {143.12,date(),1,13, .t., "1st line" + CRLF + "2nd line" + CRLF + "3rd line" }
		aRows [14]	:= {153.12,date(),2,14, .f., "1st line" + CRLF + "2nd line" + CRLF + "3rd line" }
		aRows [15]	:= {163.12,date(),3,15, .t., "1st line" + CRLF + "2nd line" + CRLF + "3rd line" }
		aRows [16]	:= {173.12,date(),1,16, .f., "1st line" + CRLF + "2nd line" + CRLF + "3rd line" }
		aRows [17]	:= {183.12,date(),2,17, .t., "1st line" + CRLF + "2nd line" + CRLF + "3rd line" }
		aRows [18]	:= {193.12,date(),3,18, .f., "1st line" + CRLF + "2nd line" + CRLF + "3rd line" }
		aRows [19]	:= {113.12,date(),1,19, .t., "1st line" + CRLF + "2nd line" + CRLF + "3rd line" }
		aRows [20]	:= {123.12,date(),2,20, .f., "1st line" + CRLF + "2nd line" + CRLF + "3rd line" }

		@ 10,60 GRID Grid_1 ;
		WIDTH 620 ;
		HEIGHT 330 ;
		HEADERS {'Column 1','Column 2','Column 3','Column 4','Column 5', 'Column TXT'} ;
		WIDTHS {140,140,140,140,140, 100} ;
		ITEMS aRows ;
		EDIT ON CHANGE playbeep() ;
		COLUMNCONTROLS { {'TEXTBOX','NUMERIC','$ 999,999.99'} , {'DATEPICKER','DROPDOWN'} , {'COMBOBOX',{'One','Two','Three'}} , { 'SPINNER' , 1 , 20 } , { 'CHECKBOX' , 'Yes' , 'No' }, Nil } ;
		CELLNAVIGATION

		@ 10,10 SLIDER Slider_1 ;
                RANGE 1,10 ;
                VALUE 1 ;
                TOOLTIP "Grid Row Height" ;
                VERTICAL ;
                ON CHANGE  { || ( SetGridRowHeight ( "Form_1", "Grid_1", Form_1.Slider_1.Value * 12 ), Form_1.RowHeight_label.Value := Str( Form_1.Slider_1.Value * 12, 3 ) ) }

                @ 130, 10 LABEL RowHeight_label VALUE Str( Form_1.Slider_1.Value * 12, 3 ) WIDTH 45

	END WINDOW

	CENTER WINDOW Form_1

	ACTIVATE WINDOW Form_1

Return

****************
Function SetGridRowHeight ( cFormName, cGridName, nHeight )

Local cDummyPNG := "mem:__Dummy_" + cFormName + "_" + cGridName + ".png"
Local hBitmap := BT_BitmapCreateNew (1, nHeight, { 255, 255, 255 } )
Local Ret := BT_BitmapSaveFile (hBitmap, cDummyPNG, BT_FILEFORMAT_PNG)
BT_BitmapRelease ( hBitmap )
   
IF Ret 
     SetProperty ( cFormName, cGridName, "Image", .T., { cDummyPNG } )
ENDIF

hb_vfErase( cDummyPNG  )

RETURN Ret
Last edited by edk on Sun May 19, 2024 6:16 am, edited 2 times in total.
User avatar
gfilatov
Posts: 1090
Joined: Fri Aug 01, 2008 5:42 am
Location: Ukraine
Contact:

Re: Alto de las filas de un grid.

Post by gfilatov »

edk wrote: Tue May 14, 2024 2:31 pm Using the same trick, I built a function that allows me to adjust the height of grid rows. Using the slider you can increase and decrease the height of the rows.
Hi Edward,

Thanks a lot for your sample :!:

It was done very cleverly. :)
Kind Regards,
Grigory Filatov

"Everything should be made as simple as possible, but no simpler." Albert Einstein
Post Reply