1. RE: EuGrid question

Matt,

As one who's used EuGrid fairly extensively, maybe I can help.  The grid 
will be cleared if you call EGW_LoadData as:

void = EGW_LoadData( grid, {{}}, EGW_REPLACE )
void = EGW_DeleteDataRow(grid, 1)

and then call repaintWindow(grid) to refresh the grid control.  I know 
this is cheesy, but the grid data is replaced by an empty row and then 
you delete the empty row you just added.

FYI, Phil hasn't been around lately and both Tony Steward and myself 
have sent requests for bug fixes/enhancments and have not heard from 
him.

Phil, if you read this and never got the requests, please let me know.

Jonas

Matt Lewis wrote:
> 
> 
> I've started using EuGrid, and I want to be able to wipe out an entire 
> grid
> (data and display).  I'm displaying tables in a database, and the 
> fields,
> size of the tables change, so it's easier to simply delete and restart
> whenever I want to display another table.  There doesn't seem to be a 
> good
> way to do this.  Here's what I've done:
> 
> -- wiping out a grid:
> cols = EGW_EnumCols( grid )
> for i = 1 to length(cols) do
>     void = EGW_DeleteCols( grid, cols[i] )
> end for
> void = EGW_LoadData( grid, {}, EGW_REPLACE )
> 
> 
> The catch is, EGW_LoadData() doesn't like it when you send an empty
> sequence, though this seems pretty obvious to me what should happen with
> EGW_REPLACE, right?  So, I added this elsif block to EGW_LoadData():
> 
> if grid > 0 and rows > 0 then
>   -- ... do lot's of stuff
> 
> elsif grid > 0 and insert_position = EGW_REPLACE then		
>     -- data = {}, so delete the whole thing...
>     GridData[grid] = data
>     GridFlag[grid] = data
>     GridCurrentCell[grid] = {-1,-1}
> end if
> 
> The only alternative to this seems to be to use EGW_DeleteDataRow(), 
> which
> would be severely inefficient.  Of course, now I have a non-standard 
> version
> of EuGrid. :(
> 
> Is there a better way?
> 
> Matt Lewis
> 
>

new topic     » topic index » view message » categorize

2. RE: EuGrid question

Ah, excellent.  Guess I didn't read the code closely enough.  I'm not sure
what you've fixed, but I just found this in EGW_DeleteColumn:

-- Adjust current cell if necessary
if GridCurrentCell[grid][COL_ID] = col_id
and column = length(GridCol[grid]) then

	-- begin mwl 7/21/03
	if column > 1 then
	
GridCurrentCell[grid][COL_ID]=GridCol[grid][column-1][EGW_COL_ID]
	elsif not length(GridCol[grid]) then
		GridCurrentCell[grid] = {-1,-1}
	end if
	-- end mwl

Basically, I was getting an out of bounds error if column = 1.

Thanks,

Matt Lewis


> From: Jonas Temple [mailto:jtemple at yhti.net]

> As one who's used EuGrid fairly extensively, maybe I can 
> help.  The grid 
> will be cleared if you call EGW_LoadData as:
> 
> void = EGW_LoadData( grid, {{}}, EGW_REPLACE )
> void = EGW_DeleteDataRow(grid, 1)
> 
> and then call repaintWindow(grid) to refresh the grid 
> control.  I know 
> this is cheesy, but the grid data is replaced by an empty row 
> and then 
> you delete the empty row you just added.
> 
> FYI, Phil hasn't been around lately and both Tony Steward and myself 
> have sent requests for bug fixes/enhancments and have not heard from 
> him.
> 
> Phil, if you read this and never got the requests, please let me know.

new topic     » goto parent     » topic index » view message » categorize

3. RE: EuGrid question

I've never seen this error.  Could you post some example code?

The only other issues I'm aware with EuGrid are:

- The sort function (right click on a column header to sort the data) 
does not work correctly for numeric values.
- If you sort a column and the first column in the data set is not 
visible, the sort is based on the data in the prior column.

Jonas

Matt Lewis wrote:
> 
> 
> Ah, excellent.  Guess I didn't read the code closely enough.  I'm not 
> sure
> what you've fixed, but I just found this in EGW_DeleteColumn:
> 
> -- Adjust current cell if necessary
> if GridCurrentCell[grid][COL_ID] = col_id
> and column = length(GridCol[grid]) then
> 
> 	-- begin mwl 7/21/03
> 	if column > 1 then
> 	
> GridCurrentCell[grid][COL_ID]=GridCol[grid][column-1][EGW_COL_ID]
> 	elsif not length(GridCol[grid]) then
> 		GridCurrentCell[grid] = {-1,-1}
> 	end if
> 	-- end mwl
> 
> Basically, I was getting an out of bounds error if column = 1.
> 
> Thanks,
> 
> Matt Lewis
> 
> 
> > From: Jonas Temple [mailto:jtemple at yhti.net]
> 
> > As one who's used EuGrid fairly extensively, maybe I can 
> > help.  The grid 
> > will be cleared if you call EGW_LoadData as:
> > 
> > void = EGW_LoadData( grid, {{}}, EGW_REPLACE )
> > void = EGW_DeleteDataRow(grid, 1)
> > 
> > and then call repaintWindow(grid) to refresh the grid 
> > control.  I know 
> > this is cheesy, but the grid data is replaced by an empty row 
> > and then 
> > you delete the empty row you just added.
> > 
> > FYI, Phil hasn't been around lately and both Tony Steward and myself 
> > have sent requests for bug fixes/enhancments and have not heard from 
> > him.
> > 
> > Phil, if you read this and never got the requests, please let me know.
> 
>

new topic     » goto parent     » topic index » view message » categorize

4. RE: EuGrid question

In order to get rid of all the columns, I did this:

cols = EGW_EnumCols( grid )
for i = 1 to length(cols) do
    void = EGW_DeleteColumn( grid, cols[i] )
end for

EGW_DeleteColumn() does a lookup on cols[i], which is just an index.  The
lookup value is the column number, which is upt into the 'column' variable.
If it happens to be 1...

GridCurrentCell[grid][COL_ID]=GridCol[grid][column-1][EGW_COL_ID]

...gives an error.

Matt Lewis


> I've never seen this error.  Could you post some example code?
> 
> The only other issues I'm aware with EuGrid are:
> 
> - The sort function (right click on a column header to sort the data) 
> does not work correctly for numeric values.
> - If you sort a column and the first column in the data set is not 
> visible, the sort is based on the data in the prior column.
> 

> > -- Adjust current cell if necessary
> > if GridCurrentCell[grid][COL_ID] = col_id
> > and column = length(GridCol[grid]) then
> > 
> > 	-- begin mwl 7/21/03
> > 	if column > 1 then
> > 	
> > GridCurrentCell[grid][COL_ID]=GridCol[grid][column-1][EGW_COL_ID]
> > 	elsif not length(GridCol[grid]) then
> > 		GridCurrentCell[grid] = {-1,-1}
> > 	end if
> > 	-- end mwl
> > 
> > Basically, I was getting an out of bounds error if column = 1.

new topic     » goto parent     » topic index » view message » categorize

5. RE: EuGrid question

Matt,

What version of EuGrid are you using?  I whipped up the following code 
(to help answer your question) and do not get an error EGW_DeleteColumn:

Jonas

--  code generated by Win32Lib IDE v0.17.0


include Win32Lib.ew
without warning
include EuGrid.ew
atom gridvoid

--------------------------------------------------------------------------------

--  Window Window1
global constant Window1 = createEx( Window, "Window1", 0, Default, 
Default, 550, 504, 0, 0 )
global integer Grid Grid = EGW_CreateGrid( Window1, 24, 8, 504, 412, 1 )
gridvoid = EGW_SetGridProperty( Grid, EGW_ROW_HEADER_DATACOL,EGW_ROWNUM 
)
gridvoid = EGW_SetGridProperty( Grid, EGW_ROW_HEADER_WIDTH,23 )
gridvoid = EGW_SetGridProperty( Grid, EGW_COL_HEADER_HEIGHT,20 )
gridvoid = EGW_SetGridProperty( Grid, EGW_BACKGROUND_COLOR,16777215 )
gridvoid = EGW_SetGridProperty( Grid, EGW_BACKGROUND_COLOR,16777215 )
global constant LoadB = createEx( PushButton, "Load", Window1, 24, 432, 
88, 28, 0, 0 )
global constant ClearB = createEx( PushButton, "Clear", Window1, 128, 
432, 88, 28, 0, 0 )
global constant DoneB = createEx( PushButton, "Done", Window1, 232, 432, 
88, 28, 0, 0 )
---------------------------------------------------------
--------------------------------------------------------------------------------

atom void
--------------------------------------------------------------------------------

procedure LoadB_onClick (integer self, integer event, sequence 
params)--params is ()
	sequence data, row_num
	void = EGW_AddColumn(Grid, "Column 1", 100, EGW_LAST,
			EGW_STATIC, 1)
	void = EGW_AddColumn(Grid, "Column 2", 100, EGW_LAST,
			EGW_STATIC, 2)
	void = EGW_AddColumn(Grid, "Column 3", 100, EGW_LAST,
			EGW_STATIC, 3)			
	data = {}			
	for i = 1 to 100 do
		row_num = sprintf("%d",i)
		data = append(data,
			{"Row " & row_num & " column 1",
			 "Row " & row_num & " column 2",
			 "Row " & row_num & " column 3"})
	end for			
	void = EGW_LoadData(Grid, data, EGW_REPLACE)
	repaintWindow(Grid)
end procedure
setHandler( LoadB, w32HClick, routine_id("LoadB_onClick"))
--------------------------------------------------------------------------------

procedure ClearB_onClick (integer self, integer event, sequence 
params)--params is ()
	sequence cols
	void = EGW_LoadData(Grid, {{}}, EGW_REPLACE)	
	void = EGW_DeleteDataRow(Grid, 1)
	cols = EGW_EnumColumns(Grid)
	for i = 1 to length(cols) do
		void = EGW_DeleteColumn(Grid, cols[i])
	end for
	repaintWindow(Grid)
end procedure
setHandler( ClearB, w32HClick, routine_id("ClearB_onClick"))
--------------------------------------------------------------------------------

procedure DoneB_onClick (integer self, integer event, sequence 
params)--params is ()
	closeWindow(Window1)
end procedure
setHandler( DoneB, w32HClick, routine_id("DoneB_onClick"))


WinMain( Window1,Normal )

new topic     » goto parent     » topic index » view message » categorize

6. RE: EuGrid question

Matt/Jonas,

I should start with an apology - I meant to ship an updated version of 
the grid ages ago but I got bogged down with (paid) work and it is still 
languishing in a slightly broken state.  

I believe I have fixed the problems with deleting datasets and the 
sorting issues ( including allowing custom sorts on columns ).  

I will try and get a working interim version and ship it as soon as I 
can.

Thanks for the feedback - all contributions gratefully received.

Phil

new topic     » goto parent     » topic index » view message » categorize

7. RE: EuGrid question

I've got v1.1.1 (the latest on the archives).  It was sort of an
intermittent bug that occured after calls to EGW_SaveDataCell.

> -----Original Message-----
> From: Jonas Temple [mailto:jtemple at yhti.net]

> What version of EuGrid are you using?  I whipped up the 
> following code 
> (to help answer your question) and do not get an error 
> EGW_DeleteColumn:
> 
> Jonas

new topic     » goto parent     » topic index » view message » categorize

8. RE: EuGrid question

Cool!

Glad to see you're still around, Phil!

Jonas
Phil Russell wrote:
> 
> 
> Matt/Jonas,
> 
> I should start with an apology - I meant to ship an updated version of 
> the grid ages ago but I got bogged down with (paid) work and it is still 
> 
> languishing in a slightly broken state.  
> 
> I believe I have fixed the problems with deleting datasets and the 
> sorting issues ( including allowing custom sorts on columns ).  
> 
> I will try and get a working interim version and ship it as soon as I 
> can.
> 
> Thanks for the feedback - all contributions gratefully received.
> 
> Phil
>

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu