[comp.sys.mac.programmer] Dialogs and TCL

dmmg1176@uxa.cso.uiuc.edu (David M Marcovitz) (02/01/91)

Are there classes in TCL to handle dialogs?  I just learned how to use
the CBartender class to play with menus, and it makes life really
easy.  I would think there would be something similar to handle dialog
boxes.  Is there anything?


--
David M. Marcovitz                     |  internet: marcovitz@uiuc.edu
Computer-based Education Research Lab  |            dmmg1176@uxa.cso.uiuc.edu
University of Illinois                 |  novanet:  marco / cca / cerl

gmarzot@mbunix.mitre.org (G. Marzot) (02/01/91)

There is no dialog class provided with the TCL. However Phillip Keller 
wrote an extension to the TCL(in ThinkC) to implement dialogs created from 
resources. The code I think is available 
via anonymous ftp from sumex-aim.stanford.edu. You'll have to hunt around 
a little for the directory.  GoodLuck  -GSM

Responsibility for the views expressed here
belongs only to myself and not to any organization.

Lawson.English@p88.f15.n300.z1.fidonet.org (Lawson English) (02/03/91)

David M Marcovitz writes in a message to All

DMM> Are there classes in TCL to handle dialogs? I just learned how 
DMM> to use the CBartender class to play with menus, and it makes 
DMM> life really easy. I would think there would be something similar 
DMM> to handle dialog boxes. Is there anything

The closest thing to it is the CAboutBox in the More Classes folder, which is
a real kludge.

What I've been thinking about is to create a new SwitchBoard class and Window
class that handle dialogues the way MacApp does. 

Basically, one must put a test into the ProcessEvent method that checks  FrontWindow
 to see if 1) is it a TCL window, and 2) if so, is it set with an "itsADialogue"
flag = TRUE.

If all of the above then you have to check for clicks outside the content region
of the front window, cmd-key-presses aside from "c," "v" and "x," and SysBeep
'em.

Elsewise you pass the event on to the inherited method. The easiest way to do
it would be to split the functionality (don't you love that word) of ProcessEvent
into two methods: ProcessEvent, which is identical until the line 

"if (isMyEvent)"

is reached, and DoEvent, which takes the EventRecord as an arguement. Your new
ProcessEvent class should now say:

if (isMyEvent) then
     DoEvent(theEventRecord);

In the base class (which substitutes for CSwitchBoard), DoEvent does exactly
what the old "if (isMyEvent)" block did. In the override method for handling
dialogues, DoEvent handles the special cases discussed above and either eats
them or passes them to inherited DoEvent.

You CDialogueWindow should have an "itsADialogue" flag that is always set to
false unless you need a modal dialogue. 

Now you can use a normal TCL window as a Dialogue window and use all the CPanes
and co. to your hearts content. If you want to be fancy, you can create a default
button, a default text field, etc. ala the MacApp dialogues. You can also have
custom controls as methods, and animation without filterprocs, etc. You can
even design the thing to work with the Dialogue templates of ResEdit, and do
a GetDialogue to load the various resources (good luck there!).

Very handy.


I'm still implementing the above, but you now have all my research and thoughts
on the subject. Go fer it if you need a CDialogue class.


Lawson
 

--  
Uucp: ...{gatech,ames,rutgers}!ncar!asuvax!stjhmc!300!15.88!Lawson.English
Internet: Lawson.English@p88.f15.n300.z1.fidonet.org

Lawson.English@p88.f15.n300.z1.fidonet.org (Lawson English) (02/03/91)

G. Marzot writes in a message to All

GM> There is no dialog class provided with the TCL. However Phillip 
GM> Keller wrote an extension to the TCL(in ThinkC) to implement 
GM> dialogs created from resources

Nothing new under the sun...


Sigh...


Lawson
 

--  
Uucp: ...{gatech,ames,rutgers}!ncar!asuvax!stjhmc!300!15.88!Lawson.English
Internet: Lawson.English@p88.f15.n300.z1.fidonet.org

dmmg1176@uxa.cso.uiuc.edu (David M Marcovitz) (02/05/91)

Lawson.English@p88.f15.n300.z1.fidonet.org (Lawson English) writes:

>David M Marcovitz writes in a message to All

>DMM> Are there classes in TCL to handle dialogs? I just learned how 
>DMM> to use the CBartender class to play with menus, and it makes 
>DMM> life really easy. I would think there would be something similar 
>DMM> to handle dialog boxes. Is there anything

>The closest thing to it is the CAboutBox in the More Classes folder, which is
>a real kludge.

I don't have a CAboutBox in my More Classes folder.  The only place I
can find a CAboutBox class is in the Art Class Folder.

>What I've been thinking about is to create a new SwitchBoard class and Window
>class that handle dialogues the way MacApp does. 

... preliminary algorithm deleted

I was hoping for something simple.  At least to start with, I just
want a very simple dialog that allows me to input a string (that I
will add to a menu).  The menu part is so easy.  Is there an easy way
to do something simple that I can add onto later?

--
David M. Marcovitz                     |  internet: marcovitz@uiuc.edu
Computer-based Education Research Lab  |            dmmg1176@uxa.cso.uiuc.edu
University of Illinois                 |  novanet:  marco / cca / cerl