Mac68k Forums

Home


Welcome, Guest
Guest Settings
Help

Mac68k Forums » Help » Software Help

Thread: disabling dialog EditText items


Reply to this Thread Reply to this Thread Search Forum Search Forum Back to Thread List Back to Thread List

Permlink Replies: 3 - Pages: 1 - Last Post: Sep 24, 2015 1:36 AM Last Post By: integerpoet
bigmessowires


Posts: 217
Registered: 10/29/13
disabling dialog EditText items
Posted: Jan 26, 2015 3:41 PM
Click to report abuse...   Click to reply to this thread Reply
I've got a dialog box with an Edit Text item. Depending on the state of some radio buttons, I want the Edit Text to either be grayed and uneditable, or normal and editable. What's the proper way to do this?

I tried:

HiliteControl((ControlHandle)itemHandle, 255);

but it seems to have no effect. But if I use the same technique of calling HiliteControl() on a radio button, it becomes grayed and unclickable. Is there something special that needs to be done to disable an Edit Text item?
bbraun


Posts: 493
Registered: 7/25/12
Re: disabling dialog EditText items
Posted: Jan 26, 2015 4:00 PM   in response to: bigmessowires in response to: bigmessowires
Click to report abuse...   Click to reply to this thread Reply
I'm not sure offhand, but all the TextEdit stuff is a bit different. Have you tried TEDeactivate()? I think that's supposed to remove the caret so you can't input text anymore.
integerpoet

Posts: 12
Registered: 9/12/15
Re: disabling dialog EditText items
Posted: Sep 13, 2015 2:39 AM   in response to: bigmessowires in response to: bigmessowires
Click to report abuse...   Click to reply to this thread Reply
I'm frightened by how much of this came flooding back to me. I hope I'm remembering correctly.

Edit text items aren't controls; they're creatures of the Dialog Manager. My guess is you get away with passing them to HighlightControl because they don't appear in the window's control list.

Dialog Manager shares a single instance of TextEdit among all the edit text items. Deactivating it is fine as long as you do nothing which induces Dialog Manager to activate it and as long as you understand that only makes the insertion point stop blinking. (Possibly if you have a selection there is some visual effect there as well.) Deactivating the instance of TE doesn't make the edit text box or text look disabled or prevent the user from clicking in them. I seem to remember all sorts of schemes to work around this, none of which were very good.

Dialog Manager is evil. Unfortunately, you are targeting old systems, so without exerting significant effort it's the best you have available.
integerpoet

Posts: 12
Registered: 9/12/15
Re: disabling dialog EditText items
Posted: Sep 24, 2015 1:36 AM   in response to: integerpoet in response to: integerpoet
Click to report abuse...   Click to reply to this thread Reply
More came back to me. :-) Historically, part of the solution was to…

Create an additional item, more specifically a user item, overlaying each edit text item which you might disable. When you want one of the edit text items to look disabled, make sure the corresponding user item is implemented. This amounts to calling SetDItem and casting the item handle to a function pointer. The function in question should use a particular transfer mode to fill gray over top of the edit text item. Done right, this knocks out roughly half of the black pixels of the edit text item, producing the disabled look. The user item can of course remain implemented as long as the relevant function is smart enough to draw nothing when the corresponding edit text item is enabled.

Of course, in addition to striking me as clumsy, this only works acceptably on black-and-white screens and even then only solves part of the problem, the visual part. The fact that the edit text item may be in use when you decide to disable it is a separate problem, as is the fact that the user may still tab into a (visually) "disabled" edit text item. There must have been a solution for these problems as well but I can't remember what they were.


Point your RSS reader here for a feed of the latest messages in all forums