1. RE: Grid Control: getting original checkbox state
- Posted by Phil Russell <pg_russell at lineone.net> Feb 10, 2003
- 448 views
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 > >
2. RE: Grid Control: getting original checkbox state
- Posted by Phil Russell <pg_russell at lineone.net> Feb 10, 2003
- 460 views
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 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! > > >
3. RE: Grid Control: getting original checkbox state
- Posted by Jonas Temple <jktemple at yhti.net> Feb 10, 2003
- 448 views
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>
4. RE: Grid Control: getting original checkbox state
- Posted by Phil Russell <pg_russell at lineone.net> Feb 10, 2003
- 455 views
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 >
5. RE: Grid Control: getting original checkbox state
- Posted by Phil Russell <pg_russell at lineone.net> Feb 10, 2003
- 471 views
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.
6. RE: Grid Control: getting original checkbox state
- Posted by Phil Russell <pg_russell at lineone.net> Feb 11, 2003
- 438 views
Dan, Dan Moyer wrote: > 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. > Oh I see. EuGrid doesn't behave like a combo box because it is designed to display multiple items whereas a combo box is designed to display/select only a single item. You *can* however have combo boxes within a grid (see the cell types tab in styles.exw), which could be an alternative to multiple checkboxes if the checkbox options are mutually exclusive. > Did you find anything in my demo that should have been done differently > or > better? The only thing that I fixed was the scroll to new cell code. I also made a few tweaks to make it look more like a list view window - feel free to ignore what you don't like! Any substantive changes are prefixed with a '***Phil:' comment line. Let me know if I can do anything else to help. Regards, Phil 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) --***Phil: Make grid look a bit more like a list view void = EGW_SetGridProperty( aGrid, EGW_NULL_GRID_COLOR, BrightWhite) void = EGW_SetGridProperty( aGrid, EGW_CELL_BORDER, False) -- Filename column -- ***Phil: Make this a protected edit field to get highlighting --colFileName = EGW_AddColumn( aGrid, "FileName", 200, EGW_LAST, EGW_STATIC, 1 ) colFileName = EGW_AddColumn( aGrid, "FileName", 100, EGW_LAST, EGW_EDIT, 1 ) --void = EGW_SetColumnProperty(aGrid, colFileName, EGW_COL_ALIGN, EGW_CENTER) void = EGW_SetColumnProperty(aGrid, colFileName, EGW_COL_EDITABLE, False) --void = EGW_SetColumnProperty( aGrid, colFileName, EGW_COL_WIDTH, 75 ) -- checkbox columns: colCB1 = EGW_AddColumn(aGrid, "Action1", 60, EGW_LAST, EGW_CHECKBOX, 2 ) void = EGW_SetColumnProperty(aGrid, colCB1, EGW_COL_ALIGN, EGW_CENTER) colCB2 = EGW_AddColumn(aGrid, "Action2", 60, EGW_LAST, EGW_CHECKBOX, 3 ) void = EGW_SetColumnProperty(aGrid, colCB2, EGW_COL_ALIGN, EGW_CENTER) -- file directory column: colFileDir = EGW_AddColumn( aGrid, "FileDirectory", 226, 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) --***Phil: Not necessary unless you are doing database manipulation *** --void = EGW_SetDataRowFlag(aGrid, row, EGW_ROW_NEW, True) -- Go to it? --***Phil: You can't use EGW_LAST here - use row number from EGW_AddDataRow instead -- void = EGW_ScrollToCell(aGrid, EGW_LAST, colFileName) --repaintWindow(Window1) --***Phil Start -- Repaint window to make sure new row is displayed repaintWindow(aGrid) -- Scroll to first column of new row void = EGW_ScrollToCell( aGrid, row, colFileName ) --***Phil End 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 )