Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
General
GeneralPortable MacsHardwareNetworking
Applications
Mac ApplicationsEudoraFirefox / MozillaInternet ExplorerOutlook ExpressMS OfficeEntourageExcelPowerPointWordVirtual PCMedia PlayerOther MS Products
Programming
Mac ProgrammingCodeWarriorPerl
Country Specific
Australian Mac GroupUK Mac Group

Mac Forum / Programming / Mac Programming / January 2006



Tip: Looking for answers? Try searching our database.

How to mimic modal default/cancel in modeless dialog

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
slashlos@optonline.net - 23 Dec 2005 19:44 GMT
[noob alert!, this is mpw 3.6.7, os/9.1]

I create a dialog, populate items and present using ModalDialog() but
that's too restrictive. Instead, I just ShowWindow() and process events
after IsDialogEvent() tells me so.

What I want to do is to mimic the button hi-lite you get when you press
Command-. or Enter/Return where the buttons [for dialog items items 2
and 1 respectively] are pressed.

Maybe I'm going about this wrong, but I want to mimic the visual display
of a modal window, but process modeless.

Any help appreciated, thanks.
Signature

 /los "I was a teenage net-random"
------------------------------------------------------------------------
Opinions expressed here are mine and not necessarily those of my employer!
------------------------------------------------------------------------

Uli Kusterer - 25 Dec 2005 18:44 GMT
> [noob alert!, this is mpw 3.6.7, os/9.1]
>
[quoted text clipped - 10 lines]
>
> Any help appreciated, thanks.

I suppose you're writing straight Classic, not to CarbonLib? CarbonLib
has methods to set the default button of a window, and the standard
event handler will take care of the rest.

In the case of straight Classic, try to get hold of Inside Macintosh:
Toolbox Essentials. It mentions that and more. IIRC you're supposed to
handle the keyboard events directly, by yourself. To highlight the
button, one used to use HiliteControl(), Delay() for 4 ticks and then
unhighlight it again.

HTH,
-- Uli Kusterer
http://www.zathras.de
slashlos@optonline.net - 06 Jan 2006 23:40 GMT
yes that helped a BUNCH! Thanks; sort of related, can't I create dialog
controls, such as a slider or pop-up [for a choice list] in ResEdit, or
must I use [and learn] Rez language? Thanks in advance.

>>[noob alert!, this is mpw 3.6.7, os/9.1]
>>
[quoted text clipped - 24 lines]
> -- Uli Kusterer
> http://www.zathras.de

Signature

 /los "I was a teenage net-random"
------------------------------------------------------------------------
Opinions expressed here are mine and not necessarily those of my employer!
------------------------------------------------------------------------

David C. Stone - 08 Jan 2006 00:46 GMT
> yes that helped a BUNCH! Thanks; sort of related, can't I create dialog
> controls, such as a slider or pop-up [for a choice list] in ResEdit, or
> must I use [and learn] Rez language? Thanks in advance.

You can do this in ResEdit, but it's a deep, dark secret....

I'm trying to remember when the slider CDEF got added to the system
- should be fairly early (around 7?), which is when popup menu controls
also became available.  See if you can find Mac Programming primer vol 2
or similar.

Essentially, you have to know the system control ID for what you want
and create a CNTL resource corresponding to it, then add that CNTL
into your DITL/DLOG.  (At least, that's how I remember doing it - it's
been a long while!)  The relevant id numbers should be together with
the #define's in the Controls header file.
Uli Kusterer - 15 Jan 2006 17:59 GMT
> > yes that helped a BUNCH! Thanks; sort of related, can't I create dialog
> > controls, such as a slider or pop-up [for a choice list] in ResEdit, or
[quoted text clipped - 6 lines]
> also became available.  See if you can find Mac Programming primer vol 2
> or similar.

No, System 7 only added the popup. Slider arrived with Appearance, i.e.
sometime around System 8, along with a lot of other stuff you wouldn't
want to miss.

> Essentially, you have to know the system control ID for what you want
> and create a CNTL resource corresponding to it, then add that CNTL
> into your DITL/DLOG.  (At least, that's how I remember doing it - it's
> been a long while!)  The relevant id numbers should be together with
> the #define's in the Controls header file.

Just one annoying thing about CNTLs: You have to specify the rect for
the control in the CNTL as numbers, you can't resize it in ResEdit's
DITL editor. The commercial resource editor Resorcerer would take care
of that for you, I think.

HTH,
-- Uli
http://www.zathras.de
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.