1. Grid Control: how disable checkbox(s)?
- Posted by Dan Moyer <DANIELMOYER at prodigy.net> Feb 16, 2003
- 439 views
Phil, How could I cause checkbox(s) in a grid to become disabled? Dan Moyer
2. Re: Grid Control: how disable checkbox(s)?
- Posted by Dan Moyer <DANIELMOYER at prodigy.net> Feb 18, 2003
- 417 views
Phil, Not too clunky, albeit a "disable" would be cleaner. Thanks. Since I'm trying to let the state of one checkbox in a row determine whether another checkbox in that row is intended to be able to be checked by the user, I'll just always replace the "lastchecked" with a "0" in the secondary checkbox if the "primary" checkbox is itself unchecked (both when the user checks off the primary, and if the secondary is attempted to be checked). Only minor problem I see is a graphic one: the simulated disabled checkbox doesn't indicate that it's disabled by being grayed out, but that's ok for now. Dan ----- Original Message ----- From: "Phil Russell" <pg_russell at lineone.net> To: "EUforum" <EUforum at topica.com> Sent: Monday, February 17, 2003 2:25 AM Subject: RE: Grid Control: how disable checkbox(s)? > > Dan, > > You can set an entire column of checkboxes to be disabled by setting the > column property of EGW_COL_EDITABLE to False. Disabling individual > cells is a bit harder as this property is not (yet!) supported for > individual cells - eventually I intend that you will be able to set most > column properties for an individual cell but I this is dependent on some > other changes first. > > I have come up with a workaround which is a little clunky but seems to > work. See below... > > Regards, > > Phil > > Dan Moyer wrote: > > Phil, > > > > How could I cause checkbox(s) in a grid to become disabled? > > > > 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 > > -- Save state of last checkbox clicked > object last_checkbox_state > > -- 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_LINE_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 - row 1 disabled", 120, EGW_LAST, > EGW_CHECKBOX, 2 ) > void = EGW_SetColumnProperty(aGrid, colCB1, EGW_COL_ALIGN, EGW_CENTER) > colCB2 = EGW_AddColumn(aGrid, "Action2 - all disabled", 120, EGW_LAST, > EGW_CHECKBOX, 3 ) > void = EGW_SetColumnProperty(aGrid, colCB2, EGW_COL_ALIGN, EGW_CENTER) > void = EGW_SetColumnProperty(aGrid, colCB2, EGW_COL_EDITABLE, False) > > -- 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 > <snip> > >