Page 6 of 7

Re: Canvas based Grid gadget

Posted: Wed Apr 03, 2019 5:15 pm
by LiK137
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.

Re: Canvas based Grid gadget

Posted: Wed Apr 03, 2019 6:40 pm
by skywalk
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.

Re: Canvas based Grid gadget

Posted: Thu Apr 04, 2019 2:38 pm
by LiK137
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.

Re: Canvas based Grid gadget

Posted: Thu Apr 04, 2019 9:42 pm
by said
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: Select all

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

Re: Canvas based Grid gadget

Posted: Thu Apr 04, 2019 9:48 pm
by LiK137
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.

Re: Canvas based Grid gadget

Posted: Tue Dec 24, 2019 6:03 am
by singo
@said

Thank you very much for your Grid gadget, I have used it successfully in one project already in combination with Google SQL Cloud.

I was wondering if it was possible to have something like

EditCell(Gadget.i, Row, Col, SetCellFocus = #True)

where after calling the cell is ready for immediate editing, without having to click the mouse to start the editing process.

P.S. Seasons Greetings ! :)

Re: Canvas based Grid gadget

Posted: Tue Dec 24, 2019 12:18 pm
by mk-soft
Is like Excel, only not the F2 key but the Enter key.

Had once added the F2 key for editing

Re: Canvas based Grid gadget

Posted: Thu Dec 26, 2019 7:05 am
by singo
Thank you and yes AFTER clicking an editable cell you can then use the Return key.

But I want my program to do this NOT the user.

I would like my program to start and immediately be in an editable cell without any user clicking the mouse or pressing any keys.

Is this possible ?

Thank you

Re: Canvas based Grid gadget

Posted: Thu Dec 26, 2019 9:52 am
by said
singo wrote:
I would like my program to start and immediately be in an editable cell without any user clicking the mouse or pressing any keys.
Hi Singo,

First, glad to hear that my work was helpful to you, you are welcome ... and Seasons Greetings to everyone
I see the great mk-soft is trying to help as always!

The default editing mode is: when in a cell, you start typing and you exit with any keys ... you overwrite existing content
The other mode is you hit enter in a cell and then the caret is placed at the end of current cell-text, so any new typed text is placed at the end ... you are appending new text to existing one

Back to your question, i believe this is the default mode, am i missing something here?

Said

Re: Canvas based Grid gadget

Posted: Thu Dec 26, 2019 1:15 pm
by mk-soft
I think he wants to initialize the edit mode from a cell via the program, but this is not a standard.

Re: Canvas based Grid gadget

Posted: Fri Dec 27, 2019 8:48 am
by singo
mk-soft wrote:I think he wants to initialize the edit mode from a cell via the program, but this is not a standard.
Yes, exactly, I'm sorry if I wasn't clear but that is what I want to do.

I want to use the grid for data entry and I don't want the user to have to click every time they want to make an entry.

Re: Canvas based Grid gadget

Posted: Wed Feb 16, 2022 9:44 pm
by mk-soft
Version: v2.4
Update: 16.02.2022
- Added SetStyleItemList
- Added Keyboard Escape, Tab, Return to Combo
- Optimize open combo (position up or down)

Link: https://github.com/mk-soft-65/MyGrid/tr ... e-function

Re: Canvas based Grid gadget

Posted: Thu Feb 17, 2022 10:17 am
by captain_skank
A very nice grid control.

I'm probably misunderstanding this, but can individual row heights be set ? I've tried both :

SetRowHeight(Gadget.i, GRow.i, Height.i = #Default_RowHeight) and
AutoHeightRow(Gadget.i, GRow)

But it's unclear if this row specific or global.

I need to have variable row heights when getting text and blobs(text again) from a database so i currently use the web gadget and HTML tables but it's not as fast in data population and i have to limit it to about 200 rows.

Cheers

Re: Canvas based Grid gadget

Posted: Thu Feb 17, 2022 11:24 am
by mk-soft
The height is only calculated on one line.
Let's see how I can adjust this. Maybe I will use my DrawTextBox function and also support fixed line breaks.

At time only on line ...

Code: Select all

    Define row
    For row = 1 To MyGrid::GetRowCount(#Grid_Nbr)
      MyGrid::AutoHeightRow(#Grid_Nbr, row)
    Next

Re: Canvas based Grid gadget

Posted: Tue May 09, 2023 2:42 pm
by MarcoAb
Thanks in advance for this really useful Grid.
There is the possibility to decide how many rows can appear when I use a col type COMBO ?
I can change color, font. height ec.. but I can't find a way to make appear more than 5 lines of choice.
ok i can scroll but for a long list of choices (eg 20) it is faster to click on the chosen item.

Cheers