Hi said,
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
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