[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problems writing an NDA



In article <C276AA.7GC@CAM.ORG> vandry@CAM.ORG (Phillip Vandry) writes:
>This is my first desktop program so pardon me for asking a few stupid questions
>:)
>
>1. When I call _HiliteMenu to hilight a menu when the menu bar colors are
>   non standard, the menu still gets hilighted in black & white. Why?

  HiliteMenu is (supposed) to be used for turning off the hilighted menu item
after the app finishes serving the menu item (no pun intended :) ) That is, the
Desk Mgr toolset hilights the menu item when you select it with the mouse. Its
then up to you (the app) to unhilight it; though as far as I know, the only
consequence of forgetting is a wierd looking menu!

>
>2. How does an NDA go about obtaining it's own UserID? EXEs get it from the
>   accumulator and S16s from _MMStartUp, but how do DAs do it?

  I'm going to assume you're writing this in C, Pascal, or TML Basic. Here's
what I would do. First off, your libraries may already have a function or a
global int that gives you the UserID. In Orca/C, this is the "userid()" fn,
and likewise in Orca/Pascal. Both take no arguments, and return an int. The
same may be true of TML Basic as well.
  If this doesn't work, allocate some memory dynamically, then ask the MM
for a handle which contains the address (value of pointer var) using the
FindHandle call. Decompose the handle struct to get the UserID (it'll be
yours).
  P.S. The findhandle call is:

extern pascal void **FindHandle(int dummy,void *address);

according to my toolset reference.
(function prototypes for Orca/C)
>
>3. My NDA creates a _NewModelessDialog. Currently there are no items in the
>   dialog. The problem is that if the window gets opened while there is a
>   pending update event for another window, the update only executes after
>   the modeless dialog is closed. Is this normal? If so, I don't like it.
>   I tried to follow the code more or less exactly from someone else's NDA
>   for which I have the soure code. The only difference is that the other
>   NDA calls NewWindow, not NewModelessDialog, but what's the difference.
>   And this other NDA works well (the pending update runs immediately)

  Take a hint! The newer practice is to use windows for everything except
modal dialogs, and use alerts for these (using the "no icon" option if you
don't want the alert icons in the upper-left corner).
  BTW, it'll be easier if you use resources to "install" the buttons and
stuff into the window. (If you don't know about resources, buy the "Learning
to Program the Toolbox" set (for Orca C/Pascal) by Mike Westerfield; way
cool stuff!)

>
>If anyone has idea, thanks ahead of time.
> ______________________________________________________________________
>|~~~~~~~~~~~~~~~~|~~~~~~~~~~~~~~~~|~~~~~~~~~~~~~~~~|~~~~~~~~~~~~~~~~~~~|
>| Phillip Vandry | Vandry@Cam.Org | II the future! | II 1993!          |
>|________________|________________|________________|___________________|
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

                                        wsquires@lonestar.utsa.edu
                                        "How 'bout them Cowboys!"