Page 3 of 5

Re: [Module] GridExModule.pbi

Posted: Wed Nov 22, 2017 9:48 pm
by skywalk
Issues:
1. Example 1 & 2:
Cell focus does not follow browsing the grid with arrow keys.
Must use a LMBClick to change focus?

2. Example 2:
[Home] key jumps to top cell of column, not left-most cell of row?
[Ctrl+Home] does jump to top left cell.
[Ctrl+End] does jump to bottom right cell.

3. Example 1:
Maybe not GridEx related and more the example code, but resizing the window is very quirky and blanks the grid and Import/Export buttons.

4. Example 1 & 2:
[Ctrl+LMBClick] selects an entire row.
Does not allow non-contiguous cell selections?

Re: [Module] GridExModule.pbi

Posted: Fri Nov 24, 2017 3:26 pm
by Thorsten1867
Update:
  • Select rows by clicking on the header of the row with the CRTL & left mouse button.
  • Select single cells with CRTL & left mouse click
  • Home now jumps to the first column and end to the last column

Re: [Module] GridExModule.pbi

Posted: Fri Nov 24, 2017 4:56 pm
by skywalk
When I use arrow keys to browse the grid, the row/col never updates to the current cell?

Line 3973: Debug "-> "+Str(Row)+" / "+Str(Col) ;<-- How to query current row/col after arrow keys?

Re: [Module] GridExModule.pbi

Posted: Fri Nov 24, 2017 6:14 pm
by Thorsten1867
skywalk wrote:When I use arrow keys to browse the grid, the row/col never updates to the current cell?
Added: GetCurrentCell(GID.i, Flag.i) ; #Row / #Column

Code: Select all

Line 8864: Debug GetCurrentCell(GID, #Column)

Re: [Module] GridExModule.pbi

Posted: Sat Nov 25, 2017 8:06 pm
by Thorsten1867
Added: Save/Load grid as worksheet (including the used images)

The files with the data, the design and the current theme are stored in a ZIP container. Additionally used pictures are saved inside.
For testing I added a sample worksheet.

Re: [Module] GridExModule.pbi

Posted: Sun Nov 26, 2017 1:23 am
by Zebuddi123
Hi Thorsten1867 Only the GridEx_Example.xgd file in the zip THanks for sharing :)

Re: [Module] GridExModule.pbi

Posted: Sun Nov 26, 2017 1:54 am
by wombats
Using #PB_Any as the GadgetID doesn't seem to work.

Code: Select all

Enumeration
  #Win
EndEnumeration

If OpenWindow(#Win, 0, 0, 800, 470, "GridEX - Gadget", #PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_MaximizeGadget|#PB_Window_ScreenCentered|#PB_Window_SizeGadget)
  
  Grid = GridEx::Gadget(#Win, #PB_Any, 10, 10, 470, 138, 6, 7, GridEx::#NoScrollBars)
  
  GridEx::Hide(Grid, #True)
  
  Repeat
    
    event = WaitWindowEvent()
    
  Until event = #PB_Event_CloseWindow
  
EndIf

Re: [Module] GridExModule.pbi

Posted: Sun Nov 26, 2017 12:19 pm
by Thorsten1867
wombats wrote:Using #PB_Any as the GadgetID doesn't seem to work.
Bug fixed!

Re: [Module] GridExModule.pbi

Posted: Mon Nov 27, 2017 6:56 am
by wombats
Thorsten1867 wrote:
wombats wrote:Using #PB_Any as the GadgetID doesn't seem to work.
Bug fixed!
Works great now!

Is it possible to prevent the user from typing in a particular cell? I thought GridEx::#NoEdit might do the trick, but seemingly not.

Re: [Module] GridExModule.pbi

Posted: Mon Nov 27, 2017 11:27 am
by Thorsten1867
wombats wrote:Is it possible to prevent the user from typing in a particular cell? I thought GridEx::#NoEdit might do the trick, but seemingly not.
Bug fixed!

Re: [Module] GridExModule.pbi

Posted: Mon Nov 27, 2017 6:44 pm
by wombats
Thorsten1867 wrote:
wombats wrote:Is it possible to prevent the user from typing in a particular cell? I thought GridEx::#NoEdit might do the trick, but seemingly not.
Bug fixed!
Thanks!

Is there a bug in GridEx::AddRow? It doesn't seem to be able to insert rows before existing rows.

If you have two GridEx controls, the second one loses its font if it is the same font name as the first. However, if you set it to a different font name to the first GridEx, it works.

Code: Select all

XIncludeFile("GridExModule.pbi")

Enumeration
  #Win
EndEnumeration

If OpenWindow(#Win, 0, 0, 800, 470, "GridEX - Gadget", #PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_MaximizeGadget|#PB_Window_ScreenCentered|#PB_Window_SizeGadget)
  
  Grid1 = GridEx::Gadget(#Win, #PB_Any, 10, 10, 300, 250, 6, 7, GridEx::#NoScrollBars)
  Grid2 = GridEx::Gadget(#Win, #PB_Any, 325, 10, 300, 250, 6, 7, GridEx::#NoScrollBars)
  
  GridEx::SetFont(Grid1, "Verdana", 9)
  GridEx::SetFont(Grid2, "Verdana", 9)
  
  GridEx::Refresh(Grid1)
  GridEx::Refresh(Grid2)
  
  Repeat
    
    event = WaitWindowEvent()
    
  Until event = #PB_Event_CloseWindow
  
EndIf

Re: [Module] GridExModule.pbi

Posted: Tue Nov 28, 2017 10:29 am
by Thorsten1867
I hope the bug is now fixed.

Re: [Module] GridExModule.pbi

Posted: Wed Dec 13, 2017 3:19 pm
by wombats
In the Free() procedure, it doesn't seem to free all of the gadgets created for the GridEx. I was having issues with the ContainerGadget being left behind. I changed the Free() procedure to the following and the issue went away.

Code: Select all

  Procedure   Free(GID.i)
    If IsGadget(GID)
      FreeGadget(GID)
      If FindMapElement(Grid(), Str(GID))
        If IsGadget(Grid()\GId\Canvas) : FreeGadget(Grid()\GId\Canvas) : EndIf
        If IsGadget(Grid()\GId\HScroll) : FreeGadget(Grid()\GId\HScroll) : EndIf
        If IsGadget(Grid()\GId\VScroll) : FreeGadget(Grid()\GId\VScroll) : EndIf
        If IsGadget(Grid()\GId\String) : FreeGadget(Grid()\GId\String) : EndIf
        If IsGadget(Grid()\GId\ListView)  : FreeGadget(Grid()\GId\ListView)  : EndIf
        If IsGadget(Grid()\GId\Container) : FreeGadget(Grid()\GId\Container) : EndIf
      EndIf
      DeleteMapElement(Grid(), Str(GID))
    EndIf
  EndProcedure

Re: [Module] GridExModule.pbi

Posted: Wed Dec 13, 2017 5:57 pm
by Thorsten1867
Changed

Re: [Module] GridExModule.pbi

Posted: Thu Dec 14, 2017 1:17 am
by wombats
Thanks for fixing the bugs I've mentioned so far!

I'm experiencing odd behaviour when adding rows. Sometimes when a row is added, the rows above it change position, and sometimes the new row isn't added where I expected it.

I've been using this to test, but each time it acts differently. I've noticed that if a new row is added as the first row, then sometimes it will move down one when rows are added below it.

Code: Select all

XIncludeFile("GridExModule.pbi")

Enumeration
  #Win
  #Container
  #Container2
  #Button1
  #Button2
EndEnumeration

Global Grid1

Procedure OnButtonClicked()
  row = GridEx::GetAttribute(Grid1, GridEx::#Attrib_Row)
  GridEx::AddRow(Grid1, "new", row - 1)
  GridEx::Refresh(Grid1)
EndProcedure

If OpenWindow(#Win, 0, 0, 800, 470, "GridEX - Gadget", #PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_MaximizeGadget|#PB_Window_ScreenCentered|#PB_Window_SizeGadget)
  
  ButtonGadget(#Button1, 350, 10, 100, 30, "Add Row")

  Grid1 = GridEx::Gadget(#Win, #PB_Any, 10, 10, 300, 250, 6, 7, GridEx::#NoScrollBars)
  GridEx::SetFont(Grid1, "Verdana", 9) : GridEx::Refresh(Grid1)
  
  BindGadgetEvent(#Button1, @OnButtonClicked())
  
  Repeat
    event = WaitWindowEvent()
  Until event = #PB_Event_CloseWindow
  
EndIf