[comp.windows.ms] WFW buttons in a box -- SOLUTION!!!!

pbrown@triton.unm.edu (Paul V Brown CS) (02/19/91)

Hi!

  About 2 weeks ago, I posted a question about how to get a dialog box with
2 or so buttons, with labels such as Mary and Joe, in order for the user
to say who he/she was, and have default values set to make life easier, in
case the 2 users of a system have different setups that they prefer.
Yesterday I finally broke down and bought the Technical Reference for WFW,
and came up with the following:  It produces a box with "directions" on
what to do, 3 buttons, labeled Minna, Paul and Other, 1 OK button, and 1
Cancel Button.  Then, based on the input from the user, sets the default
directory to the appropriate one, and changes the author field appropriately.

On all but the Begin Dialog command, the #'s given are
x-coord., y-coord., x-width, y-heighth -- you can change the values and
see what happens.  The coordinates are with respect to the box created in
Begin Dialog.  Oh, this is the AutoExec macro, by the way.  If you have any
questions, feel free to write, but realize that I'm under an extremely
heavy workload, so it may take me a week to get back to you.  Enjoy!!

--Paul V. Brown
pbrown@triton.unm.edu

Sub MAIN 
 
Begin Dialog UserDialog 300, 100 
  Text 5, 10, 200, 20, "Choose the user, please:" 
  OptionGroup .UserName 
    OptionButton 50, 30, 128, 20, "Minna" 
    OptionButton 50, 50, 128, 20, "Paul" 
    OptionButton 50, 70, 128, 20, "Other"
  OKButton 200, 30, 75, 18 
  CancelButton 200, 60, 75, 18 
End Dialog 

Dim WhichUser As Dialog UserDialog  'Creates a "record" for the dialog box
  On Error Goto outtahere   'I cannot figure out where this is supposed
                            'to go (I found it in several places) but it
                            'works here, so I left it here.
Dialog WhichUser  'This displays the dialog box
 
  'Now we need to evaluate the answer, and make any necessary changes! 
  Select Case WhichUser.UserName  'Tech Ref conveniently leaves out "Select"
    Case 0 
      ChDir("C:\WINDOWS\MINNA") 
      UtilCustomize .Name = "Minna Marikka Lampola", .Initials = "MML" 
    Case 1 
      ChDir("C:\WINDOWS\PAUL") UtilCustomize .Name = "Paul Vinson Brown", .Initials = "PVB" 
    Case 2 
      ChDir("C:\WINDOWS") 
    Case Else 
  End Select 
 
outtahere: 
 
End Sub