Page 4 of 5

Re: [Module] GridExModule.pbi

Posted: Thu Dec 14, 2017 9:12 am
by Thorsten1867
Try this one.

Re: [Module] GridExModule.pbi

Posted: Fri Dec 15, 2017 2:25 am
by wombats
That seems to have fixed that. Thanks.

I'm not sure AddRow() is returning the right value. I assume it is supposed to return the number of the new row. Is that right? Can you check it, please? I'm afraid I don't really understand the code.

Re: [Module] GridExModule.pbi

Posted: Fri Dec 15, 2017 7:51 am
by Thorsten1867
AddRow() returns the new number of rows.

Re: [Module] GridExModule.pbi

Posted: Fri Dec 15, 2017 11:08 am
by wombats
Thorsten1867 wrote:AddRow() returns the new number of rows.
Ah, OK. Thanks for clarifying that.

Re: [Module] GridExModule.pbi

Posted: Tue Dec 19, 2017 10:20 am
by QuimV
Please,
How much rows and cols can I add to the GridEx.
In my test I can add only 12 rows!!
Is that correct?
Thanks

Re: [Module] GridExModule.pbi

Posted: Tue Dec 19, 2017 2:04 pm
by Thorsten1867
Actually, the number of rows should not matter. Can you describe the problem in more detail?

Re: [Module] GridExModule.pbi

Posted: Tue Dec 19, 2017 2:08 pm
by QuimV
This is my code:

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" + #CRLF$ + "Column 2", 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, "Arial", 10) : GridEx::Refresh(Grid1)
  
  BindGadgetEvent(#Button1, @OnButtonClicked())
  
  
  Repeat
    event = WaitWindowEvent()
  Until event = #PB_Event_CloseWindow
  
EndIf
Click button #Button1 more than 12 times, please
Max number of rows are 12

Re: [Module] GridExModule.pbi

Posted: Tue Dec 19, 2017 4:45 pm
by Thorsten1867
I tested the code and could add over 30 lines.

Re: [Module] GridExModule.pbi

Posted: Tue Dec 19, 2017 6:44 pm
by QuimV
:oops: @Thorsten1867
My mistake is that I expected a vertical scroll bar to appear
Thanks

Re: [Module] GridExModule.pbi

Posted: Thu Jan 11, 2018 7:37 pm
by QuimV
When I press the up or down arrows, the selected cell loses focus.
If I press the left or right arrows, the focus is restored.
Is this correct?
I use a virtual machine windows 7 professional 32 bits and PB5.61

Re: [Module] GridExModule.pbi

Posted: Sun Jan 14, 2018 2:46 pm
by Dave L
I have noticed an unexpected result in the #Cash column.

In example 1 I entered value -2500000,65 and it displayed as -2.500.000,75.

PB function works as expected: FormatNumber(-2500000.65,2,",",".") = -2.500.000,65.

I work on financial software, #Cash columns with correct outcome are helpful :wink:

Is #Cash formatting reliable ?


Update:
Found it: in _FormatCell() replace ValF() with ValD() and everything works fine ...

Re: [Module] GridExModule.pbi

Posted: Sun Jan 21, 2018 5:07 am
by kinglestat
Really well done

Re: [Module] GridExModule.pbi

Posted: Fri Feb 02, 2018 4:55 am
by wombats
When right-clicking on the grid, it cancels the selection. Is there a way to change that? If a popup menu is opened, the user will be expecting the selected item to affect the selection they made. If that selection is cancelled, the popup menu won't do as they expect.

Also, what's the best way to get the currently selected row(s)? I do the following, but when multiple rows are selected, it always returns those rows as the selection, and it doesn't allow for single selection.

Code: Select all

GridEx::GetSelection(*grid)
firstRow = GridEx::Area\Row\First
lastRow = GridEx::Area\Row\Last
Finally, when the grid has only a single column, and it is longer than the width of the gadget, the scrollbar doesn't adjust so the user can see the rest of the cell.

Re: [Module] GridExModule.pbi

Posted: Mon Aug 05, 2019 8:32 am
by collectordave
I am trying to use the GridEx module to display a lengthy dataset in 200 row chunks. Number of rows in Gridex set to 200

I set the Vscroll maximum to the number of rows in the dataset.

After clicking the VScroll it counts up to 182 but no further. I can get the next 200 records by adding up the number of offsets used but the VSCroll value returned by

Debug GetGadgetState(gridex::GetAttribute(DBGrid,Gridex::#Attrib_GadgetRowScroll)) never climbs above the 182. It appears tied to the number of rows in the grid.

I would prefer to use the gadget state to select the next 200 records.

Can I get over this?

Regards

CD

Re: [Module] GridExModule.pbi

Posted: Mon Aug 05, 2019 12:35 pm
by collectordave
Got over the problem by creating the grid with no scroll bars and adding my own to the side.

Works a treat now.