It is currently Thu Dec 05, 2019 3:28 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 81 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6
Author Message
 Post subject: Re: Canvas based Grid gadget
PostPosted: Thu Aug 23, 2018 1:17 pm 
Offline
Addict
Addict
User avatar

Joined: Fri May 12, 2006 6:51 pm
Posts: 2053
Location: Germany
@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:
Code:
  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 / OOP-BaseClassDispatch / EventDesigner V3
PB v3.30 / v5.70 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace


Top
 Profile  
Reply with quote  
 Post subject: Re: Canvas based Grid gadget
PostPosted: Wed Apr 03, 2019 5:15 pm 
Offline
Enthusiast
Enthusiast

Joined: Wed Jun 23, 2010 5:13 pm
Posts: 206
Very nice gadget and useful.
Adding few hundred records to grid with sql select loop is may seem no problem but 6K records take 20 seconds with elapsedmilliseconds and disabled debugger on intel i5 8GB RAM. 27MB RAM and 50% CPU is used.

Would be very thankful for solution.


Top
 Profile  
Reply with quote  
 Post subject: Re: Canvas based Grid gadget
PostPosted: Wed Apr 03, 2019 6:40 pm 
Offline
Addict
Addict
User avatar

Joined: Wed Dec 23, 2009 10:14 pm
Posts: 3140
Location: Boston, MA
Rich gadgets are not intended to populate entire data set. Change your code to fill only 50 or whatever records and use scrollbars to update.

_________________
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum


Top
 Profile  
Reply with quote  
 Post subject: Re: Canvas based Grid gadget
PostPosted: Thu Apr 04, 2019 2:38 pm 
Offline
Enthusiast
Enthusiast

Joined: Wed Jun 23, 2010 5:13 pm
Posts: 206
Thank You very much.
I got that part but scrolling is not working.

I have digged deeper and found that "shift", "ctrl" and "ctrl"+"shift" handled but not #PB_Canvas_Shift and Srolling

Strange part that MyGrid example is working.


Last edited by LiK137 on Thu Apr 04, 2019 9:42 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: Canvas based Grid gadget
PostPosted: Thu Apr 04, 2019 9:42 pm 
Offline
Enthusiast
Enthusiast

Joined: Thu Apr 14, 2011 6:07 pm
Posts: 341
LiK137 wrote:
Very nice gadget and useful.
Adding few hundred records to grid with sql select loop is may seem no problem but 6K records take 20 seconds with elapsedmilliseconds and disabled debugger on intel i5 8GB RAM. 27MB RAM and 50% CPU is used.

Would be very thankful for solution.

Hi,

To load big number of rows, i would use it this way (not sure if you are not using it already though):
Code:
MyGrid::NoRedraw(Gadget)
.... load huge data here ...
MyGrid::Redraw(Gadget)

What skywalk has mentioned is certainly very valid, however the events received by the scrollbars are bound to an internal procedures via BindGadgetEvent() that synchronize the drawing _SynchronizeGridCols() and _SynchronizeGridRows() ... It wont be easy to change those routines so you can intercept scrollbars events! At least i wont do it myself! Not sure if more recent versions of PB offer more flexibility regrading scrollbars events, i am no longer using PB these days



Said


Top
 Profile  
Reply with quote  
 Post subject: Re: Canvas based Grid gadget
PostPosted: Thu Apr 04, 2019 9:48 pm 
Offline
Enthusiast
Enthusiast

Joined: Wed Jun 23, 2010 5:13 pm
Posts: 206
Thank You very much.

I agree with that big data should be handled by partial load with scrolling.

And I see that scrolling is handled and index is changing based on direction of scrolling.
Arrow keys with any combination (Ctrl and/or Shift) events are handled
MoveLeft...MoveDown is Handled but grid is not changing/refreshing.

Finaly, Redraw(Gadget) was just resizing while NoRedraw(Gadget) was changing flag permanently.
That is why grid was not refresing. Just Copied NoRedraw as AutoRedraw with flag set #True.

ThanQ very much again for replies.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 81 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 9 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye