1. Mistake in wxEuphoria version 16
- Posted by Vinoba Jun 24, 2011
- 1765 views
-- wxEuphoria version 16 -- modified pgrid.exw for column (fields) headings. include "wxeu/wxeud.e" without warning object void constant Properties = {"Name", "Class", "Parent", "ID", "Caption", "Location", "Size", "Style"} constant frmMain = create( wxFrame, {0, -1, "Property Grid Demo", -1, -1, 980, 520} ), pnlMain = create( wxPanel, {frmMain} ), grdProp = create( wxGrid, {pnlMain, -1, 10, 10, 800, 220, 0, 12, 8} ) set_col_label_size( grdProp, 0 ) set_row_label_align( grdProp, wxLEFT, 0 ) set_col_size( grdProp, 0, 100 ) set_grid_margins( grdProp, 0, 0 ) -- modifed code select_grid_row( grdProp, 0 ) select_grid_col( grdProp, 0 ) -- end modifed code for i = 1 to length( Properties ) do -- modifed code select_grid_cell( grdProp, 0, i-1) set_col_label( grdProp, i-1, Properties[i] ) -- end modifed code set_row_size( grdProp, i-1, 23) end for wxMain( frmMain )
E:\EU\TestWX\..\wxeu\wxeud.e:12935 in procedure select_grid_row()
C routine +select_grid_row() needs 3 arguments, not 2
grid = 54463912
row = 0
... called from E:\EU\TestWX\pgrid.exw:18
In wxeud.e documentation I find the following:
-- Selects the specified row. public procedure select_grid_row( atom grid, integer row ) c_proc( WX_SELECT_GRID_ROW, {grid, row} ) end procedure
I changed the row number form 0 to 1 just in case, but the error persists.
2. Re: Mistake in wxEuphoria version 16
- Posted by Vinoba Jun 24, 2011
- 1725 views
In wxeud.e the code was,
WX_SELECT_GRID_COL = wx_define_c_proc( "select_grid_col", {dll:C_POINTER,dll:C_INT,dll:C_INT } ), WX_SELECT_GRID_ROW = wx_define_c_proc( "select_grid_row", {dll:C_POINTER,dll:C_INT,dll:C_INT } ), ......
I removed the extra parameter dll:C_INT in both "select_grid_col" and "select_grid_row"
WX_SELECT_GRID_COL = wx_define_c_proc( "select_grid_col", {dll:C_POINTER,dll:C_INT} ), WX_SELECT_GRID_ROW = wx_define_c_proc( "select_grid_row", {dll:C_POINTER,dll:C_INT} ), -- It was accepted, but set_col_label does not work at top of columns the same way as -- set_row_label does for the rows! set_col_label( grdProp, i-1, Properties[i] ) -- was not accepted. -- However, set_cell_value ( grdProp, Properties[i], 0, i-1, ) -- was accepted and the field heading come through nicely, at the top of each column.
The remaining question is "Why does "set_col_label" NOT work, while the "set_row_label" works in the original demo.
If you think that my change in Matt's code was OK, it might be incorporated in the next version.
3. Re: Mistake in wxEuphoria version 16
- Posted by mattlewis (admin) Jun 25, 2011
- 1720 views
The remaining question is "Why does "set_col_label" NOT work, while the "set_row_label" works in the original demo.
If you think that my change in Matt's code was OK, it might be incorporated in the next version.
Thanks for finding this issue. The problem is with the code in wxeud.e that call the C functions. Originally, there were only two parameters. However, in r469, I see that I added the "add_to_selected" parameters in the C++ code. Here is what the function prototypes look like now:
void WXEUAPI select_grid_row( intptr_t grid, int row, int add_to_selected ) void WXEUAPI select_grid_col( intptr_t grid, int col, int add_to_selected )
The euphoria wrappers inside of wxeud.e are automatically generated based on the C++ files. So it will pick up on new functions, and automatically add wrappers in there. After the C++ functions were changed, I forgot to update the euphoria wrapper. The define_c_func calls are regenerated each time. However, if there is already a euphoria routine for a particular function, it's left alone.
In this case, there were already wrappers, so the automatic update didn't change the functions, and neither did I. I've updated the code and committed it to svn. If you want to patch your file locally, here's what the functions should look like:
--/topic wxGrid --/proc select_grid_row( atom grid, integer row, integer add_to_selected ) -- --Selects the specified row. public procedure select_grid_row( atom grid, integer row, integer add_to_selected ) c_proc( WX_SELECT_GRID_ROW, {grid, row, add_to_selected} ) end procedure --/topic wxGrid --/proc select_grid_col( atom grid, integer col, integer add_to_selected ) -- --Selects the specified column. public procedure select_grid_col( atom grid, integer col, integer add_to_selected ) c_proc( WX_SELECT_GRID_COL, {grid, col, add_to_selected}) end procedure
I've bumped the version to v0.16.1 in svn. If I don't get any other reports in the next few days, I'll probably release that as-is.
Matt
4. Re: Mistake in wxEuphoria version 16
- Posted by Vinoba Jun 25, 2011
- 1672 views
Thanks for the quick attention to the "select_grid_row() and select_grid_col()" I will update my version as suggested above by you and keep the three parameters.
I still have the issue with "set_col_label" and had to rely on "set_cell_value " which seems to work well to set up the field labels in row 0 (first row). The question I had put was
""Why does "set_col_label" NOT work, while the "set_row_label" works in the original demo."
I am sure there is a simple answer to it or a slight correction.
for i = 1 to length( Properties ) do select_grid_cell( grdProp, 0, i-1) -- This line does not work -- set_col_label( grdProp, i-1, Properties[i] ) -- the follwing line works set_cell_value ( grdProp, Properties[i], 0, i-1, ) set_row_size( grdProp, i-1, 23) end for wxMain( frmMain )
5. Re: Mistake in wxEuphoria version 16
- Posted by mattlewis (admin) Jun 26, 2011
- 1606 views
I still have the issue with "set_col_label" and had to rely on "set_cell_value " which seems to work well to set up the field labels in row 0 (first row). The question I had put was
""Why does "set_col_label" NOT work, while the "set_row_label" works in the original demo."
I am sure there is a simple answer to it or a slight correction.
Oops, sorry, I missed that. Actually, it is pretty easy to fix.
Remove this line from your code:
set_col_label_size( grdProp, 0 )
Matt
6. Re: Mistake in wxEuphoria version 16
- Posted by Vinoba Jun 26, 2011
- 1653 views
Matt:
I have made a reasonably good demo file for Grid class. If you think it is OK to add to the demos of wxEuphoria, please go ahead and do so.
It can download it from
7. Re: Mistake in wxEuphoria version 16
- Posted by mattlewis (admin) Jun 27, 2011
- 1588 views
I have made a reasonably good demo file for Grid class. If you think it is OK to add to the demos of wxEuphoria, please go ahead and do so.
Thanks! I've added it with a couple of little tweaks. I just put the grid into a sizer so that it automatically resizes.
Matt
8. Re: Mistake in wxEuphoria version 16
- Posted by Vinoba Jun 27, 2011
- 1578 views
In wxeud.e documentation I find the following:
-- Selects the specified row. public procedure select_grid_row( atom grid, integer row ) c_proc( WX_SELECT_GRID_ROW, {grid, row} ) end procedure
In the next version the documentation needs changing to reflect the three parameters of
select_grid_row and select_grid_col
Also in the main manual,
proc select_grid_col( atom grid, integer col ) proc select_grid_row( atom grid, integer row )
needs to be changed
This should complete the discussion about this "mistake" - might as well add the word "solved' in the heading, if you wish.