Dear sirs! I am using your Component Pack Pro on Delphi 2009 / Intraweb 10.23
There are so many properties and methods in your AdvGrid comp that it is very difficult to get the right ones just for minor tasks. So it would be very helpfull if you could give me a hand on this:
I do some database query and want to manually populate the grid. The grid itself is placed on a region, which is invisible at form creation and made visible when the user presses a button for customer selection. The user is only allowed to select several rows and press some buttons (on the region!) for further actions.
Here is the first problem: at form creation the grid cell borders are visible on the main form thow the region is invisible?! After pressing the button to make the region visible and after that pressing the close button (making the region invisible again) the grid borders are'nt shown anymore. I could solve this by setting the visible property of the grid to false too at form creation; but after that the grid won't be drawn anymore.
I set the Page controller to cpPageList, Type cptButton, RowCount to 8 rows per Page
Before filling the grid with data I want to clear the grid and use the following lines:
grdKSearch.TotalRows := grdKSearch.RowCount;
The query selects 10 rows and so I set the TotalRows property to 10, filling the cells with the query results. I added the following lines after that to show the new cell contents and clear row selections:
This works so far but then the next problem occurs: When pressing the button for Page2 nothing happens. I changed the AsyncPaging property to false for testing but now the grid disappears after pressing the button for page 2
I hope you can give me some advice on solving my problems with the AdvGrid. What are the correct property settings to only allow the user to select some rows; how to get the selected rows and solve the problems described above.
Many thanks in advance!
Thank you for your assistance!
I tried your test project and found the problem:
The region with my WebGrid is overlapping the main form as if a separate (modal) form would be shown when the visible property of the region is set to true (all other elements on the form are disabled then).
When the visible property of the grid is true at form creation the borders of the grid are visible allthough the region is not! (This is the bug you mentioned?)
Due to the fact, that the Webgrid will work when it's Visible property is set to false at form creation I added some code to the forms AfterRender event:
TIWAdvWebGrid1.Visible := false;
This hides the row borders and the grid will be drawn correctly when the toggle button is pressed (added the line "TIWAdvWebgrid.Visible := not TIWAdvWebGrid.Visible")
But now the pager has no effect anymore! So I am not able to use my invisible region as a modal form fake :(
BTW: What is the correct value of the property "MouseSelect!" to show the user the selected rows in a different color?
Thanks for your help
- What do you mean by "the page has no effect anymore"? Can you explain exactly what the problem is?
- Set MouseSelect to msRowCheck to select rows like using a CheckBox, the rows will get the color defined in the SelectColor property.
Sorry of rmy late response - I had to work on some other projects.
I think I've found a workaround for my problem:
- At design time I set the Region and the Grid to VISIBLE = FALSE
- In the AFTERRENDER event of the form I set the Grids VISIBLE = TRUE
-> both the grid and the region are unvisible, now row drawing over the main form
- after pressing a button I set the region VISIBLE = TRUE and fill the grid
-> everything works as expected
Unfortunately I've found a new bug: using your example project I click
on Row 1 / Page 1 -> the check box is checked and the entry "1" is
added to the list box. Now I select page 2 in the pager -> The
Checkbox of row 9 is checked! Seems that drawing the new page with the
pager does not update the check boxes?! Do I have to add some code to
the "OnAsyncNextPage" Event to initialize the check boxes?
This behavior is a limitation of the AsyncPaging functionality in the IWAdvWebGrid.
Cells with complex column types like ctCheckBox and row checking are not updated after the async page change.
It is on our todo list to implement this in a future version of the control.
For now please disable AsyncPaging when using a ctCheckBox column.