dave@sun.soe.clarkson.edu (Dave Goldblatt) (03/01/90)
Is there any way to disable an editText item in a dialog box? For example, I have an editText box which I want to lock out from user changes once a particular option is selected. Seems simple, but I haven't seen anything in IM or elsewhere which says it can be done.. Any help will be greatly appreciated! -dg- -- "You can twist perceptions * Dave Goldblatt goldblat@interlan.com Reality won't budge..." * Diagnostic Engineering - Rush * Racal InterLan * Boxborough MA (508) 263-9929
nebel@wam.umd.edu (Chris D. Nebel) (03/02/90)
In article <DAVE.90Mar1105207@image.clarkson.edu> dave@sun.soe.clarkson.edu writes: > >Is there any way to disable an editText item in a dialog box? For >example, I have an editText box which I want to lock out from user >changes once a particular option is selected. Seems simple, but I >haven't seen anything in IM or elsewhere which says it can be done.. I once wrote a dialog with a single editText item which I disabled by using a filterProc. It would check for clicks on the item and keyDown events; if it saw any, it would change the itemHit to zero, and return true, i.e., lie and say "Yes, I've handled this event." With a bit of work, this technique could (I think :) be extended to work with multiple editText items, but I haven't had to do this yet, so I'm not quite sure how. If someone knows an elegant solution, I'd like to know too! Chris Nebel nebel@wam.umd.edu
zben@umd5.umd.edu (Ben Cranston) (03/02/90)
In article <DAVE.90Mar1105207@image.clarkson.edu> dave@sun.soe.clarkson.edu writes: > Is there any way to disable an editText item in a dialog box? For > example, I have an editText box which I want to lock out from user > changes once a particular option is selected. Seems simple, but I > haven't seen anything in IM or elsewhere which says it can be done.. In article <1990Mar1.170635.29828@wam.umd.edu> nebel@wam.umd.edu (Chris D. Nebel) writes: > I once wrote a dialog with a single editText item which I disabled by > using a filterProc. It would check for clicks on the item and keyDown > events; if it saw any, it would change the itemHit to zero, and return > true, i.e., lie and say "Yes, I've handled this event." > With a bit of work, this technique could (I think :) be extended to > work with multiple editText items, but I haven't had to do this yet, > so I'm not quite sure how. If someone knows an elegant solution, > I'd like to know too! This solution occured to me too. I think the problem is that the editText item would still be "in the circuit" for tab-advancement if there were other editText items in the same dialog. You might be able to kluge for this with the appropriate tab handling code in the filterProc, but the kluges are starting to compound here... My first cut would be to try changing the type from editText to statText with something like GetDItem/SetDItem. You need to be careful about the editField variable in the dialog record, since you probably don't want the active textEdit field to suddenly change to statText -- it could confuse the dialog manager/textEdit interfacing. Perhaps you could arrange the semantics of the dialog such that the field would never be current when its state was being patched. Perhaps a filter proc could feed back a tab to activate a different textEdit field. Changing the number of editText fields from 0 to 1 or from 1 to 0 should result in editField being set to the item number or -1 respectively, maybe even textH being dropped and reallocated. (In this case, where there is only one item being enabled and disabled, the tab problem doesn't apply, so Chris's filterproc solution might be better in this particular instance). If DTS is listening maybe a Tech Note on this would be in order... -- Sig DS.L ('ZBen') ; Ben Cranston <zben@Trantor.UMD.EDU> * Network Infrastructures Group, Computer Science Center * University of Maryland at College Park * of Ulm
russotto@eng.umd.edu (Matthew T. Russotto) (03/02/90)
In article <6193@umd5.umd.edu> zben@umd5.umd.edu (Ben Cranston) writes: >In article <DAVE.90Mar1105207@image.clarkson.edu> dave@sun.soe.clarkson.edu >writes: > >> Is there any way to disable an editText item in a dialog box? For >> example, I have an editText box which I want to lock out from user >> changes once a particular option is selected. Seems simple, but I >> haven't seen anything in IM or elsewhere which says it can be done.. > > [kludge, kludge, kludge, klude] > >If DTS is listening maybe a Tech Note on this would be in order... There is one. It's called "Don't abuse the managers". Look up the section "Dialog with the devil". Have you tried hacking the itemlist and making that thing a statictext instead of an edittext, if you REALLY want to kludge this thing? Of course, make sure it isn't the currently selected edittext. -- Matthew T. Russotto russotto@eng.umd.edu russotto@wam.umd.edu ][, ][+, ///, ///+, //e, //c, IIGS, //c+ --- Any questions?