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>