Canvas based Grid gadget
Re: Canvas based Grid gadget
@davido, Andre and KCC the great, you are welcome and thanks for the nice words
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
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
- OldSkoolGamer
- Enthusiast
- Posts: 150
- Joined: Mon Dec 15, 2008 11:15 pm
- Location: Nashville, TN
- Contact:
Re: Canvas based Grid gadget
Yes, this is definitely great!! Thanks for this. I'm going to replace the editable grid I have now in my current project with this one as it's much more powerful and has some features already done I need.
Re: Canvas based Grid gadget
In the past days i had the chance to test more thoroughly this gadget, found few bugs and updated the help file
Any bug report is most welcome
So a revised version is available on the same github page ... see first post
Said
Any bug report is most welcome
So a revised version is available on the same github page ... see first post
Said
Re: Canvas based Grid gadget
Great work!
On linux I had to remove the constant at line 5026and I had to add a Font at line 3037
On linux I had to remove the constant at line 5026
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)
Re: Canvas based Grid gadget
@said,
Nice work, thank you for sharing.
@#NULL,
Also works on the Mac. Thanks for the tip.
Nice work, thank you for sharing.
@#NULL,
Also works on the Mac. Thanks for the tip.
DE AA EB
Re: Canvas based Grid gadget
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)
-
- New User
- Posts: 1
- Joined: Thu Jan 04, 2018 6:00 am
Re: Canvas based Grid gadget
Looks good as of Jan 3 2018. Hope development continues.
Re: Canvas based Grid gadget
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
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
Re: Canvas based Grid gadget
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
You are welcome! Can you please show the steps that lead to described 'bug' ... i am unable to see the issue?!
Said
Re: Canvas based Grid gadget
Thanks,
in the exampe if you open the windows to the max , combo box not fased when click on the arrow...
if you resize is seems ok ... but if go max ...problem
Maurizio
in the exampe if you open the windows to the max , combo box not fased when click on the arrow...
if you resize is seems ok ... but if go max ...problem
Maurizio
Re: Canvas based Grid gadget
Sorry Maurizio, i am still unable to reproduce!
Even installed PB 5.62 for this, still cant reproduce ... Tested on Windows 10 (both PB 32/64) with 200 DPI screen as well
Is anyone else facing this issue? Thanks for reporting
Even installed PB 5.62 for this, still cant reproduce ... Tested on Windows 10 (both PB 32/64) with 200 DPI screen as well
Is anyone else facing this issue? Thanks for reporting
Re: Canvas based Grid gadget
Hi said,
I just needed your code in a small project, but after implemented a 'fixed' size, I found some confusing things:
If I set the size calculation to the 'right' values (#Grid1) then it looks to big.
The 'fault' growth when I increase the rows for example.
If I fix it by using a size which is one pixel smaller (#Grid2) (maybe the border pixel),
then it looks good, but...
when I go to the lowest row, via key down, it 'jumps' one row.
Same happens to the end of the cols.
Is this 'normal' behaviour or is there a small bug inside?
Is it an inconsistent usage of ColWidth and RowHeight?
In one case with border in one without.
I use the latest version from your link in post 1.
PB 5.62 x86 on Win10 x64
P.S.: one thing I was struggling about: everywhere it is width, height
In your New it is width, height, ROWS, COLS. I first used width, height, COLS, ROWS, which was wrong
Bernd
I just needed your code in a small project, but after implemented a 'fixed' size, I found some confusing things:
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
The 'fault' growth when I increase the rows for example.
If I fix it by using a size which is one pixel smaller (#Grid2) (maybe the border pixel),
then it looks good, but...
when I go to the lowest row, via key down, it 'jumps' one row.
Same happens to the end of the cols.
Is this 'normal' behaviour or is there a small bug inside?
Is it an inconsistent usage of ColWidth and RowHeight?
In one case with border in one without.
I use the latest version from your link in post 1.
PB 5.62 x86 on Win10 x64
P.S.: one thing I was struggling about: everywhere it is width, height
In your New it is width, height, ROWS, COLS. I first used width, height, COLS, ROWS, which was wrong
Bernd
Re: Canvas based Grid gadget
Hi Bernd,
You have guessed it right, there is always 1 pixel for the border (be it horizontal or vertical)
I believe, this little jump at the end of rows/cols is due to 1 pixel missing, here is how i would use this grid with a fixed size (your example re-worked):
I hope this helps
Said
You have guessed it right, there is always 1 pixel for the border (be it horizontal or vertical)
I believe, this little jump at the end of rows/cols is due to 1 pixel missing, here is how i would use this grid with a fixed size (your example re-worked):
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
Said
- the.weavster
- Addict
- Posts: 1537
- Joined: Thu Jul 03, 2003 6:53 pm
- Location: England
Re: Canvas based Grid gadget
@said
This is excellent!
Thank you very much for sharing
This is excellent!
Thank you very much for sharing
Re: Canvas based Grid gadget
@said
very nice module.
Combobox works now under MacOS with Workaround for CanvasGadget
Link to FixResizeGadget: viewtopic.php?f=24&t=71269
P.S. MacOS
If the width of ScrollBarGadget to small then change the scrollbar to vertical
Fix:
[/size]
very nice module.
Combobox works now under MacOS with Workaround for CanvasGadget
Link to FixResizeGadget: viewtopic.php?f=24&t=71269
P.S. MacOS
If the width of ScrollBarGadget to small then change the scrollbar to vertical
Fix:
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
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive