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