1. Grid Control: getting original checkbox state
- Posted by Dan Moyer <DANIELMOYER at prodigy.net> Feb 10, 2003
- 507 views
Ok, another question about Grid Control, & checkboxes: When I try to get the state of a checkbox in a column/row, I can get what is probably a useful result, but *not* from the original state of the checkbox. When the checkbox is first displayed, it shows as checked, and if I use the following code to interrogate its state, it returns a *null sequence*, which tells me nothing; however, if I click on the checkbox to change it to un-checked, the same code below will then report "0", & if I then re-click on the checkbox to set it to checked, the code below returns a "1", both of which are correct & useful, but why doesn't the code work on the original checked state? *Maybe* it's from how I defined the checkbox in "newRow", with an empty sequence? newRow = {fName,"","",dirName } If so, how should I have defined the checkbox otherwise? <code snippet to get checkbox state:> procedure PushButton3_onClick (integer self, integer event, sequence params) --params is () object result result = EGW_GetDataCellValue ( aGrid, 1, 2 ) -- using 1 for first row, 2 for first column with a checkbox puts(1, sprint(result)) end procedure setHandler( PushButton3, w32HClick, routine_id("PushButton3_onClick")) Dan Moyer
2. Re: Grid Control: getting original checkbox state
- Posted by Dan Moyer <DANIELMOYER at prodigy.net> Feb 10, 2003
- 504 views
Double sigh & nevermind! I gotta think first before I ask questions! Seems if I put a "1" in my newRow sequence where checkboxes go, it then allows correct interrogation of original checkbox state: newRow = {fName,1,1,dirName } Should'a tried *something* before asking, since I *did* have a clue. Dan Moyer ----- Original Message ----- From: "Dan Moyer" <DANIELMOYER at prodigy.net> To: "EUforum" <EUforum at topica.com> Sent: Sunday, February 09, 2003 9:01 PM Subject: Grid Control: getting original checkbox state > > Ok, another question about Grid Control, & checkboxes: > > When I try to get the state of a checkbox in a column/row, I can get what is > probably a useful result, but *not* from the original state of the checkbox. > > When the checkbox is first displayed, it shows as checked, and if I use the > following code to interrogate its state, it returns a *null sequence*, which > tells me nothing; however, if I click on the checkbox to change it to > un-checked, the same code below will then report "0", & if I then re-click > on the checkbox to set it to checked, the code below returns a "1", both of > which are correct & useful, but why doesn't the code work on the original > checked state? > > *Maybe* it's from how I defined the checkbox in "newRow", with an empty > sequence? > newRow = {fName,"","",dirName } > > If so, how should I have defined the checkbox otherwise? > > > <code snippet to get checkbox state:> > procedure PushButton3_onClick (integer self, integer event, sequence params) > --params is () > object result > > result = EGW_GetDataCellValue ( aGrid, 1, 2 ) -- using 1 for first row, 2 > for first column with a checkbox > puts(1, sprint(result)) > end procedure > setHandler( PushButton3, w32HClick, routine_id("PushButton3_onClick")) > > Dan Moyer > > > > TOPICA - Start your own email discussion group. FREE! >
3. Re: Grid Control: getting original checkbox state
- Posted by Dan Moyer <DANIELMOYER at prodigy.net> Feb 10, 2003
- 465 views
Phil, It does take some getting used to, but it's a very nice looking & functioning control! Here's a suggestion: Since I'm trying to use it essentially like a ListView with checkboxes, I wonder if it could be made to have an option to behave even more like a list, such that instead of initially showing its whole innate height, it would only show however many rows it has been given, up to its innate height, and then begin to scroll when the number (or space) of rows exceeds the space provided by its height? Dan Moyer ----- Original Message ----- From: "Phil Russell" <pg_russell at lineone.net> To: "EUforum" <EUforum at topica.com> Sent: Monday, February 10, 2003 2:10 AM Subject: RE: Grid Control: getting original checkbox state > > Hi Dan, > > Sorry to be so long in getting back to you, but at least Jonas replied > and he probably knows as much about using EuGrid as anybody! > > Just to confirm what you have discovered through (painful?) experience: > > - If you allocate more than one visible column to the same column in the > underlying dataset then if the data in one of the visible columns is > changed then they will all be updated at the same time. > > - At the moment, checkbox values are only able to cope with values of > True or False. Any data value that is not 'False' is assumed to be True > - this includes a null sequence "". If you modify a checkbox by > clicking on it then the underlying data will always be converted to a > True/False value i.e. you will lose the original underlying data if it > was not a boolean value. > > - As Jonas and others have found, occasionally the grid does not > automatically repaint itself and it is necessary to issue a > repaintWindow call. This was actually deliberate so that it would be > possible to change lots of screen elements in one go without causing a > load of repaints and screen flicker. However I have been toying with > the idea of having a grid property of 'automatic redraw' which would > make sure that the grid was always repainted - this could be useful for > small grids & during development. > > Please keep posting your questions & comments. For one thing it is the > only feedback that I get & for another it is nice to know that the > control is actually being used! I am still developing it (albeit slowly > at the moment) and any suggestions and/or bug reports are very welcome. > > Regards, > > Phil > > Dan Moyer wrote: > > Double sigh & nevermind! I gotta think first before I ask questions! > > Seems > > if I put a "1" in my newRow sequence where checkboxes go, it then allows > > correct interrogation of original checkbox state: > > newRow = {fName,1,1,dirName } > > > > Should'a tried *something* before asking, since I *did* have a clue. > > > > Dan Moyer > > > > > > > TOPICA - Start your own email discussion group. FREE! >
4. Re: Grid Control: getting original checkbox state
- Posted by Dan Moyer <DANIELMOYER at prodigy.net> Feb 10, 2003
- 493 views
Hi Phil, Well, that's close but not exactly what I meant; refer to the demo following this (& if it's a poor way to do what I'm trying to do, by all means make corrections!). Consider when a Grid Control is created: it shows up as a rectangle of x-y dimensions, even though it could be *empty* to begin with. Then add *one* row of data: the row shows up, but inside an otherwise *empty* rectangle. If you then add additional rows of data, eventually it will have to vertically scroll, which it does. What I am suggesting is that when it *originally* shows, if it has no data, just the top legends should (optionally) show; then, if *one* row is added, *just that row* would show under the legends, *not* the whole empty grid rectangle. And then, as now, when enough rows are added so there's not enough space for them, scroll bars obtain. Dan Moyer <code follows:> -- code generated by Win32Lib IDE v0.14.2 include Win32lib.ew without warning ---------------------------------------------------------------------------- ---- -- Window Window1 constant Window1 = createEx( Window, "Grid Control with CheckBoxes", 0, Default, Default, 600, 300, 0, 0 ) constant PushButton2 = createEx( PushButton, "Select File", Window1, 484, 20, 88, 28, 0, 0 ) constant PushButton3 = createEx( PushButton, "Process Data", Window1, 484, 72, 88, 28, 0, 0 ) --------------------------------------------------------- ---------------------------------------------------------------------------- ---- include eugrid.ew atom void integer aGrid, colFileName, colCB1, colCB2, colFileDir -- Create grid, create parms=(parent, x, y, width, height, show_window) aGrid = EGW_CreateGrid( Window1, 10, 15, 450, 200, True ) -- no row header void = EGW_SetGridProperty( aGrid, EGW_ROW_HEADER_WIDTH, 0) -- Filename column - static text, left-aligned by default colFileName = EGW_AddColumn( aGrid, "FileName", 200, EGW_LAST, EGW_STATIC, 1 ) void = EGW_SetColumnProperty(aGrid, colFileName, EGW_COL_ALIGN, EGW_CENTER) --void = EGW_SetColumnProperty( aGrid, colFileName, EGW_COL_WIDTH, 75 ) -- checkbox columns: colCB1 = EGW_AddColumn(aGrid, "Action1", 100, EGW_LAST, EGW_CHECKBOX, 2 ) void = EGW_SetColumnProperty(aGrid, colCB1, EGW_COL_ALIGN, EGW_CENTER) colCB2 = EGW_AddColumn(aGrid, "Action2", 100, EGW_LAST, EGW_CHECKBOX, 3 ) void = EGW_SetColumnProperty(aGrid, colCB2, EGW_COL_ALIGN, EGW_CENTER) -- file directory column: colFileDir = EGW_AddColumn( aGrid, "FileDirectory", 400, EGW_LAST, EGW_STATIC, 4 ) void = EGW_SetColumnProperty(aGrid, colFileDir, EGW_COL_ALIGN, EGW_CENTER) ---------------------------------------------------------------------------- ---- procedure PushButton2_onClick (integer self, integer event, sequence params)--params is () seq fName, dirName, fullPathName, temp seq newRow int row, posBS -- posBS is position of back-slash in file name temp = {} -- get a file name fName = getOpenFileName( Window1, current_dir() & "\\", "" ) -- entered a file name? if length( fName ) = 0 then return end if -- separate filename from dirName: if find('\\',fName) then -- found back-slash -- work from end, remove chars after last back-slash: for n = length(fName) to 1 by -1do if not equal('\\',fName[n]) then temp = prepend(temp,fName[n]) else posBS = n exit end if end for fullPathName = fName dirName = fName[1..posBS -1] fName = temp else dirName = "" end if newRow = {fName,1,1,dirName } -- example relating to adding new row: --global constant EmptyGridRow = {"", 2, "", "", 0, True} -- Add new row to grid: row = EGW_AddDataRow(aGrid, newRow, EGW_LAST) void = EGW_SetDataRowFlag(aGrid, row, EGW_ROW_NEW, True) -- Go to it? -- void = EGW_ScrollToCell(aGrid, EGW_LAST, colFileName) repaintWindow(Window1) end procedure setHandler( PushButton2, w32HClick, routine_id("PushButton2_onClick")) ---------------------------------------------------------------------------- ---- procedure PushButton3_onClick (integer self, integer event, sequence params)--params is () object result atom numOfRows numOfRows = EGW_GetRowCount ( aGrid ) for n = 1 to numOfRows do result = EGW_GetDataCellValue ( aGrid, n, 2 ) puts(1, sprint(result)) result = EGW_GetDataCellValue ( aGrid, n, 3 ) puts(1, sprint(result)) puts(1, "\n") end for end procedure setHandler( PushButton3, w32HClick, routine_id("PushButton3_onClick")) WinMain( Window1,Normal ) ----- Original Message ----- From: "Phil Russell" <pg_russell at lineone.net> To: "EUforum" <EUforum at topica.com> Sent: Monday, February 10, 2003 7:20 AM Subject: RE: Grid Control: getting original checkbox state > > Hi Dan, > > The scrollbars in EuGrid only appear when the number of rows or width of > visible columns exceed the size of the window. In that sense the > vertical scrollbar should act in a similar way to a listbox. If you > size the columns so that they all fit in the window size then you won't > get a horizontal scrollbar either. > > To make it look even more like a listbox you would need to: > > - hide the row header > - make the grid background colour the same as the row background colour > - make the grid line colour the same as the grid background colour. > > Is that what you meant? I can send you an example if you like... > > Regards, > > Phil > Dan Moyer wrote: > > Phil, > > > > It does take some getting used to, but it's a very nice looking & > > functioning control! > > > > Here's a suggestion: > > Since I'm trying to use it essentially like a ListView with checkboxes, > > I > > wonder if it could be made to have an option to behave even more like a > > list, such that instead of initially showing its whole innate height, it > > would only show however many rows it has been given, up to its innate > > height, and then begin to scroll when the number (or space) of rows > > exceeds > > the space provided by its height? > > > > Dan Moyer > > > > > > ----- Original Message ----- > > From: "Phil Russell" <pg_russell at lineone.net> > > To: "EUforum" <EUforum at topica.com> > > Sent: Monday, February 10, 2003 2:10 AM > > Subject: RE: Grid Control: getting original checkbox state > > > > > > > Hi Dan, > > > > > > Sorry to be so long in getting back to you, but at least Jonas replied > > > and he probably knows as much about using EuGrid as anybody! > > > > > > Just to confirm what you have discovered through (painful?) experience: > > > > > > - If you allocate more than one visible column to the same column in the > > > underlying dataset then if the data in one of the visible columns is > > > changed then they will all be updated at the same time. > > > > > > - At the moment, checkbox values are only able to cope with values of > > > True or False. Any data value that is not 'False' is assumed to be True > > > - this includes a null sequence "". If you modify a checkbox by > > > clicking on it then the underlying data will always be converted to a > > > True/False value i.e. you will lose the original underlying data if it > > > was not a boolean value. > > > > > > - As Jonas and others have found, occasionally the grid does not > > > automatically repaint itself and it is necessary to issue a > > > repaintWindow call. This was actually deliberate so that it would be > > > possible to change lots of screen elements in one go without causing a > > > load of repaints and screen flicker. However I have been toying with > > > the idea of having a grid property of 'automatic redraw' which would > > > make sure that the grid was always repainted - this could be useful for > > > small grids & during development. > > > > > > Please keep posting your questions & comments. For one thing it is the > > > only feedback that I get & for another it is nice to know that the > > > control is actually being used! I am still developing it (albeit slowl y > > > at the moment) and any suggestions and/or bug reports are very welcome. > > > > > > Regards, > > > > > > Phil > > > > > > Dan Moyer wrote: > > > > Double sigh & nevermind! I gotta think first before I ask questions! > > > > Seems > > > > if I put a "1" in my newRow sequence where checkboxes go, it then allows > > > > correct interrogation of original checkbox state: > > > > newRow = {fName,1,1,dirName } > > > > > > > > Should'a tried *something* before asking, since I *did* have a clue. > > > > > > > > Dan Moyer > > > > > > > > > > > TOPICA - Start your own email discussion group. FREE! > > > > > > > > TOPICA - Start your own email discussion group. FREE! >
5. Re: Grid Control: getting original checkbox state
- Posted by Dan Moyer <DANIELMOYER at prodigy.net> Feb 10, 2003
- 476 views
Phil, Oh, I should also have said: Examples, *yes*, examples are *wonderful*, the more examples the better! :) And I'm not trying to make it look like a *list* per se, but more like a *ListView*, with columns, but including checkboxes, which ListView won't do. So making the grid lines not show isn't something I'm looking for, but someone else might want to do so sometime, so an example of it isn't a bad idea in general. Most of what anyone could want to do with the Grid Control is *probably* in "Style.exw" (BTW, thanks for the mention in it!), but there's *so* much there it's a little hard to find & properly abstract it to use. That's where individual examples can be helpful. In fact, if you were to develop or obtain a large number of examples, you might even consider using "RunDemos.exw" (distributed with Win32Lib) to manage them. It allows a user to: 1. see the names & a short description of every included demo; 2. run any listed demo by double-clicking on it in the list; 3. see the code in an editor by right-clicking on any listed demo (for copy-paste); 4. and add demos with descriptions to its list. Dan Moyer ----- Original Message ----- From: "Phil Russell" <pg_russell at lineone.net> To: "EUforum" <EUforum at topica.com> Sent: Monday, February 10, 2003 7:20 AM Subject: RE: Grid Control: getting original checkbox state > > Hi Dan, > > The scrollbars in EuGrid only appear when the number of rows or width of > visible columns exceed the size of the window. In that sense the > vertical scrollbar should act in a similar way to a listbox. If you > size the columns so that they all fit in the window size then you won't > get a horizontal scrollbar either. > > To make it look even more like a listbox you would need to: > > - hide the row header > - make the grid background colour the same as the row background colour > - make the grid line colour the same as the grid background colour. > > Is that what you meant? I can send you an example if you like... > > Regards, > > Phil > Dan Moyer wrote: > > Phil, > > > > It does take some getting used to, but it's a very nice looking & > > functioning control! > > > > Here's a suggestion: > > Since I'm trying to use it essentially like a ListView with checkboxes, > > I > > wonder if it could be made to have an option to behave even more like a > > list, such that instead of initially showing its whole innate height, it > > would only show however many rows it has been given, up to its innate > > height, and then begin to scroll when the number (or space) of rows > > exceeds > > the space provided by its height? > > > > Dan Moyer
6. Re: Grid Control: getting original checkbox state
- Posted by Dan Moyer <DANIELMOYER at prodigy.net> Feb 10, 2003
- 501 views
Jonas, That's ok, and you got it exactly right. I realize the Grid Control is intended more for spreadsheet apps, I was just wondering if it could be generalized to include optional "other" looks. And I can use it just fine just like it is, too. Dan ----- Original Message ----- From: "Jonas Temple" <jktemple at yhti.net> To: "EUforum" <EUforum at topica.com> Sent: Monday, February 10, 2003 8:13 AM Subject: RE: Grid Control: getting original checkbox state > > Dan, > > Sorry to butt in on the conversation. > > I think I understand what you're wanting. You're wanting the grid > control itself to be no larger than the actual size of the rows/columns > within the control. Then the control size would expand as more data > rows were added, eventually showing a scroll bar when the control > reached it's maximum size. Is that about right? > > I believe the current behavior of EuGrid is consistent with other > "commercial" grid controls out there. Most grid controls will have > "grey space" to fill the controls size when the rows/columns don't fill > the entire control. > > It's my opinion that this behavior shouldn't be added to EuGrid. > However, one approach might be to use Don Phillip's xControls to > dynamically change the size of the grid control. Phil has done a nice > job of making sure EuGrid and xControls are compatible. > > HTH, > > Jonas > Dan Moyer wrote: > > Hi Phil, > > > > Well, that's close but not exactly what I meant; refer to the demo > > following > > this (& if it's a poor way to do what I'm trying to do, by all means > > make > > corrections!). > > > > Consider when a Grid Control is created: it shows up as a rectangle of > > x-y > > dimensions, even though it could be *empty* to begin with. Then add > > *one* > > row of data: the row shows up, but inside an otherwise *empty* > > rectangle. > > If you then add additional rows of data, eventually it will have to > > vertically scroll, which it does. > > > > What I am suggesting is that when it *originally* shows, if it has no > > data, > > just the top legends should (optionally) show; then, if *one* row is > > added, > > *just that row* would show under the legends, *not* the whole empty grid > > rectangle. And then, as now, when enough rows are added so there's not > > enough space for them, scroll bars obtain. > > > > Dan Moyer > > > > <code follows:> > > > > -- code generated by Win32Lib IDE v0.14.2 > > > > include Win32lib.ew > > without warning > > > > -------------------------------------------------------------------------- -- > > > > ---- > > -- Window Window1 > > constant Window1 = createEx( Window, "Grid Control with CheckBoxes", 0, > > Default, Default, 600, 300, 0, 0 ) > > constant PushButton2 = createEx( PushButton, "Select File", Window1, > > 484, > > 20, 88, 28, 0, 0 ) > > constant PushButton3 = createEx( PushButton, "Process Data", Window1, > > 484, > > 72, 88, 28, 0, 0 ) > > --------------------------------------------------------- > > -------------------------------------------------------------------------- -- > > > > ---- > > include eugrid.ew > > atom void > > > > integer aGrid, colFileName, colCB1, colCB2, colFileDir > > > > -- Create grid, create parms=(parent, x, y, width, height, show_window) > > aGrid = EGW_CreateGrid( Window1, 10, 15, 450, 200, True ) > > > > -- no row header > > void = EGW_SetGridProperty( aGrid, EGW_ROW_HEADER_WIDTH, 0) > > > > > > -- Filename column - static text, left-aligned by default > > colFileName = EGW_AddColumn( aGrid, "FileName", 200, EGW_LAST, > > EGW_STATIC, > > 1 ) > > void = EGW_SetColumnProperty(aGrid, colFileName, EGW_COL_ALIGN, > > EGW_CENTER) > > --void = EGW_SetColumnProperty( aGrid, colFileName, EGW_COL_WIDTH, 75 > > ) > > > > -- checkbox columns: > > colCB1 = EGW_AddColumn(aGrid, "Action1", 100, EGW_LAST, EGW_CHECKBOX, 2 > > ) > > void = EGW_SetColumnProperty(aGrid, colCB1, EGW_COL_ALIGN, EGW_CENTER) > > colCB2 = EGW_AddColumn(aGrid, "Action2", 100, EGW_LAST, EGW_CHECKBOX, 3 > > ) > > void = EGW_SetColumnProperty(aGrid, colCB2, EGW_COL_ALIGN, EGW_CENTER) > > > > -- file directory column: > > colFileDir = EGW_AddColumn( aGrid, "FileDirectory", 400, EGW_LAST, > > EGW_STATIC, 4 ) > > void = EGW_SetColumnProperty(aGrid, colFileDir, EGW_COL_ALIGN, > > EGW_CENTER) > > -------------------------------------------------------------------------- -- > > > > ---- > > procedure PushButton2_onClick (integer self, integer event, sequence > > params)--params is () > > seq fName, dirName, fullPathName, temp > > seq newRow > > int row, posBS -- posBS is position of back-slash in file name > > > > temp = {} > > > > -- get a file name > > fName = getOpenFileName( Window1, current_dir() & "\\", "" ) > > -- entered a file name? > > if length( fName ) = 0 then > > return > <snip> > > > > TOPICA - Start your own email discussion group. FREE! >
7. Re: Grid Control: getting original checkbox state
- Posted by Dan Moyer <DANIELMOYER at prodigy.net> Feb 10, 2003
- 499 views
Phil, Well actually I think your examples & docs are pretty dang good, didn't mean to imply otherwise :) Dan ----- Original Message ----- From: "Phil Russell" <pg_russell at lineone.net> To: "EUforum" <EUforum at topica.com> Subject: RE: Grid Control: getting original checkbox state > > Dan, > > I'm aware that the examples & docs are less than optimal - my only > excuse was that I was very tired when I finished the programming. I am > hoping to do better in future. > > Good idea about using RunDemo - I will look into it. Thanks. > > Phil > > > Most of what anyone could want to do with the Grid Control is *probably* > > in > > "Style.exw" (BTW, thanks for the mention in it!), but there's *so* much > > Credit where credit is due! The initial version of style.exw looked > extremely similar to your example as all the grids appeared on one form. > > > > TOPICA - Start your own email discussion group. FREE! >
8. Re: Grid Control: getting original checkbox state
- Posted by Dan Moyer <DANIELMOYER at prodigy.net> Feb 10, 2003
- 488 views
Phil, Well, I guess you're right, I must have been thinking of ComboBoxes, (rather than simple lists), which have a drop-down list which can *momentarily* obscure controls below it, but then disappear when an item in it is selected. Those drop-down lists seem to be able to be made to show only as much as is needed, up to the height of the default size of the control. But I don't need that ability, and I can use the Grid Control just fine as it is, so it would appear to be a not so good suggestion. Did you find anything in my demo that should have been done differently or better? Dan ----- Original Message ----- From: "Phil Russell" <pg_russell at lineone.net> To: "EUforum" <EUforum at topica.com> Sent: Monday, February 10, 2003 8:23 AM Subject: RE: Grid Control: getting original checkbox state > > Hi Dan, > > So you want the grid to dynamically resize to fit its contents? Well > there is nothing stopping you resizing the grid using 'setRect' as with > any other windows control. You can get hold of the row header and row > height values (both grid level properties) and size the grid > accordingly. > > However as far as I know > a) Windows list controls do *not* have this resizing behaviour > b) It would be of limited usefulness except on simple forms as you would > then have to shuffle around any other items which appeared below the > grid. > > In addition, my experience with developing Windows apps is that users > intensely dislike interfaces which suddenly change themselves around - > IMHO it is better to have a fixed size control which stays put. > > That said, if you *really* need to do this then I am happy to write an > example program. Let me know... > > Regards, > > Phil > > PS I will have to log off soon - will reply tomorrow if needed. > > > Dan Moyer wrote: > > Hi Phil, > > > > Well, that's close but not exactly what I meant; refer to the demo > > following > > this (& if it's a poor way to do what I'm trying to do, by all means > > make > > corrections!). > > > > Consider when a Grid Control is created: it shows up as a rectangle of > > x-y > > dimensions, even though it could be *empty* to begin with. Then add > > *one* > > row of data: the row shows up, but inside an otherwise *empty* > > rectangle. > > If you then add additional rows of data, eventually it will have to > > vertically scroll, which it does. > > > > What I am suggesting is that when it *originally* shows, if it has no > > data, > > just the top legends should (optionally) show; then, if *one* row is > > added, > > *just that row* would show under the legends, *not* the whole empty grid > > rectangle. And then, as now, when enough rows are added so there's not > > enough space for them, scroll bars obtain. > > > > Dan Moyer > > > > > > TOPICA - Start your own email discussion group. FREE! >