
A new update of this gadget is available now with help file (which is really needed!), i cleaned the code a lot and fixed few glitches on the way ... see first post for the link download
Said
Code: Select all
MessageRequester("Error","Unable to create file ...") ; ,#MB_ICONERROR)
Code: Select all
CompilerCase #PB_OS_Linux
Protected Font_T8 = LoadFont(#PB_Any, "Arial",11)
Yes that constant in the test-code is a left over from previous versions, i mostly use windows but the code is made of only PB native code so it should run fine on all supported platforms#NULL wrote:Great work!
On linux I had to remove the constant at line 5026and I had to add a Font at line 3037Code: Select all
MessageRequester("Error","Unable to create file ...") ; ,#MB_ICONERROR)
Code: Select all
CompilerCase #PB_OS_Linux Protected Font_T8 = LoadFont(#PB_Any, "Arial",11)
Hello,mauriegio wrote:Hello ,
thank for the grid is very useful wonderful gadget ..
I have a problem with combobox , after resize the example the combo open is non fased
on grid.
i use purebasic 5.62 on MacOs/windows and the problem is the same ...
is possible correct them ...
thank you
Maurizio
Code: Select all
#ColWidth = 40
#RowHeight = 20
#Cols = 20
#Rows = 10
Enumeration
#Grid1
#Grid2
EndEnumeration
Define.i i
IncludeFile "MyGrid.pbi"
OpenWindow(0, 0, 0, 860, 460, "Test", #PB_Window_MinimizeGadget|#PB_Window_ScreenCentered)
MyGrid::New(0, #Grid1, 10, 10, (#Cols + 1) * #ColWidth, (#Rows + 1) * #RowHeight, #Rows, #Cols, #False, #False, #False)
MyGrid::SetColWidth(#Grid1, MyGrid::#RC_Any, #ColWidth)
MyGrid::SetRowHeight(#Grid1, MyGrid::#RC_Any, #RowHeight)
MyGrid::Redraw(#Grid1)
MyGrid::New(0, #Grid2, 10, 240, (#Cols + 1) * (#ColWidth - 1), (#Rows + 1) * (#RowHeight - 1), #Rows, #Cols, #False, #False, #False)
MyGrid::SetColWidth(#Grid2, MyGrid::#RC_Any, #ColWidth)
MyGrid::SetRowHeight(#Grid2, MyGrid::#RC_Any, #RowHeight)
MyGrid::Redraw(#Grid2)
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
Code: Select all
#ColWidth = 40
#RowHeight = 20
#Cols = 20
#Rows = 10
Enumeration
#Grid1
#Grid2
EndEnumeration
Define.i i
IncludeFile "MyGrid.pbi"
OpenWindow(0, 0, 0, 860, 460, "Test", #PB_Window_MinimizeGadget|#PB_Window_ScreenCentered)
; MyGrid::New(0, #Grid1, 10, 10, (#Cols + 1) * #ColWidth, (#Rows + 1) * #RowHeight, #Rows, #Cols, #False, #False, #False)
;
; For i = 0 To #Cols
; MyGrid::SetColWidth(#Grid1, i, #ColWidth)
; Next i
;
; For i = 0 To #Rows
; MyGrid::SetRowHeight(#Grid1, i, #RowHeight)
; Next i
;
; MyGrid::Redraw(#Grid1)
; neededWidth =
neededWidth.i = (#ColWidth * (#Cols + 1) ) - #Cols
neededHeight.i = (#RowHeight * (#Rows + 1) ) - #Rows
MyGrid::New(0, #Grid2, 10, 240, neededWidth, neededHeight, #Rows, #Cols, #False, #False, #False)
For i = 0 To #Cols
MyGrid::SetColWidth(#Grid2, i, #ColWidth)
Next i
For i = 0 To #Rows
MyGrid::SetRowHeight(#Grid2, i, #RowHeight)
Next i
MyGrid::Redraw(#Grid2)
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
Code: Select all
Procedure.i New(WinNbr, Gadget, X, Y, W, H, Rows = 500, Cols = 100, DrawNow = #True, VerScrollBar = #True, HorScrollBar = #True, RowNumbers = #True)
Protected *mg.TGrid, oldGdtList
Protected ret,i,j,ttlW,ttlH,xx,yy
If Not IsWindow(WinNbr) : ProcedureReturn -1 : EndIf
If IsGadget(Gadget) : ProcedureReturn -1 : EndIf
*mg = AllocateStructure(TGrid)
; -- sub-gadgets creation
oldGdtList = UseGadgetList(WindowID(WinNbr))
ret = CanvasGadget(Gadget, X, Y, W, H, #PB_Canvas_Keyboard|#PB_Canvas_Container);|#PB_Canvas_Border)
If Gadget = #PB_Any : Gadget = ret: EndIf
*mg\RowScroll = -1
*mg\ColScroll = -1
If VerScrollBar
*mg\RowScroll = ScrollBarGadget(#PB_Any,0,0,10,20,0,100,10, #PB_ScrollBar_Vertical)
SetGadgetData(*mg\RowScroll, *mg)
BindGadgetEvent(*mg\RowScroll, @_SynchronizeGridRows(), #PB_All)
EndIf
If HorScrollBar
*mg\ColScroll = ScrollBarGadget(#PB_Any,0,0,20,10,0,100,10)
SetGadgetData(*mg\ColScroll, *mg)
BindGadgetEvent(*mg\ColScroll, @_SynchronizeGridCols(), #PB_All)
EndIf