Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...A lot of the information I've found at this site would've taken me forever if I'd have attempted to research it on my own. Thanks again."

Geography

Where in the world do Tek-Tips members come from?
Person51 (Programmer)
17 Aug 06 16:17
Hello again -
Having a problem with a dialog box, I have 3 DropListBoxes, each have at least 3 options to choose from in each one. Also, there is a CheckBox to which if the checkbox is used, a textbox comes available. I've used the DlgVisible and DlgEnable functions, and could get it all to semi-work, however, certain selections from the ListBoxes would turn the Enable / Visible on and off at when selections were made.
Here's some code :
Declare Function FileDlgFunction(identifier$, action, suppvalue) 'grabbed from the help files

Sub Main()
Dim identifier$
        Dim action as Integer
        Dim suppvalue as Integer

       
        Begin Dialog Macroname 84, 31, 412, 177, "Header Here" + ORDTN, .FileDlgFunction
            Text  10, 7, 47, 8, "Install Date", .DueDate
            TextBox  5, 20, 41, 14, .InstallDate
            Text  6, 36, 40, 20, "(MM-DD-YY)"
            Text  124, 7, 47, 8, "Order Number", .Ord_PON
            TextBox  92, 20, 84, 14, .PON
            Text  231, 8, 47, 8, "L-T ", .Listing
            DropListBox  204, 22, 95, 44, "Option 1"+chr$(9)+"Option 2"+chr$(9)+"Option 3", .DropListBox1
            Text  7, 55, 47, 8, "First Name", .FirstName
            TextBox  2, 67, 50, 14, .F_Name
            Text  62, 55, 47, 8, "Last Name", .LastName
            TextBox  53, 67, 50, 14, .L_Name
            Text  125, 55, 47, 8, "HSN", .ST_Num
            TextBox  117, 67, 36, 14, .S_Number
            Text  166, 55, 47, 8, "Dir.", .Direction
            TextBox  159, 67, 24, 14, .Dir_Type
            Text  216, 55, 47, 8, "Street Name", .ST_Name
            TextBox  194, 67, 81, 14, .S_Name
            Text  279, 55, 47, 8, "St. Type", .ST_Type
            TextBox  278, 67, 31, 14, .S_Type
            Text  6, 103, 47, 8, "Unit", .Add_Loc
            TextBox  3, 117, 24, 14, .Unit
            Text  46, 103, 47, 8, "Floor", .Add_Loc2
            TextBox  43, 117, 24, 14, .Unit2
            Text  86, 103, 47, 8, "Bldg", .Add_Loc3
            TextBox  83, 117, 24, 14, .Unit3
            Text  164, 103, 47, 8, "City", .Customer_City
            TextBox  118, 116, 102, 14, .City
            Text  232, 103, 22, 8, "Zip", .Customer_Zip
            TextBox  224, 116, 31, 14, .Zip               
            CheckBox  269, 100, 41, 14, "Comm", .CheckBox
            TextBox  268, 116, 34, 14, .Comm
            Text  29, 142, 55, 8, "Inbound Blocking", .InboundBlk
            DropListBox  5, 153, 128, 64, "Option 1"+chr$(9)+"Option 2"+chr$(9)+"Option 3"+chr$(9)+"Option 4", .DropListBox2
            Text  200, 142, 61, 8, "Outbound Blocking", .OutboundBlk
            DropListBox  164, 153, 143, 64, "Option 1"+chr$(9)+"Option 2"+chr$(9)+"Option 3"+chr$(9)+"Option 4"+chr$(9)+"Option 5", .DropListBox3
            OkButton  336, 110, 50, 20
            CancelButton  336, 142, 50, 20
            Picture  320, 11, 84, 80, "C:\Path here", 0
            GroupBox  0, 0, 312, 50, ""
            GroupBox  0, 48, 110, 50, ""
            GroupBox  112, 48, 200, 50, ""
            GroupBox  0, 96, 110, 40, ""
            GroupBox  112, 96, 147, 40, ""
            GroupBox  0, 134, 312, 36, ""
            GroupBox  314, 0, 96, 98, ""
            GroupBox  314, 96, 96, 75, ""
            GroupBox  262, 96, 50, 40, ""
        End Dialog
        
        Dim Source as Macroname
        On Error Resume Next
        Dialog Source
        If Err = 102 Then            
            STOP            
        End If
        
        Check = Source.CheckBox
        Comm_Field = Source.Comm       
         
End Sub
Function FileDlgFunction(identifier$, action, suppvalue)
Select Case action
Case 1
DlgVisible(Check)
DlgVisible(Comm_Field),0
Case 2
If DlgControlID(Check)=0 Then
   If DlgContolID(Check)<>1 Then
      DlgVisible "Check",1
      DlgVisilbe "Comm_Field",1
   End If
End If
End Select
End Function

I believe that that the ID being equal to the same positons as Option1&2 in the DropList makes it impossible to get a valid check. Any help would be welcomed.
- 51
Skie (Programmer)
17 Aug 06 17:07

CODE

Function FileDlgFunc(identifier$, action, suppvalue)
  Select Case action
  Case 1
    DlgVisible("CheckBox"),1
    DlgVisible("Comm"),0
  Case 2
    Select Case identifier$
    Case "CheckBox"
      If DlgValue("CheckBox") = 1 Then
          DlgVisible "Comm",1
      Else
          DlgVisible "Comm",0
      End If
    End Select
End Function
If you're using an identifier (like .Comm), then you request the identifier instead of a number or using source.identifier.  The identifiers are case sensative, so "Comm" works but "comm" would give you an error.
IknowMe (Programmer)
18 Aug 06 10:03
you'll need to make the following changes

Function FileDlgFunction(identifier$, action, suppvalue)
    Select Case action
        Case 1
            DlgVisible("CheckBox"),1
            DlgVisible("Comm"),0
        Case 2
            Select Case identifier$
            Case "CheckBox"
              If DlgValue("CheckBox") = 1 Then
                  DlgVisible "Comm",1
              Else
                  DlgVisible "Comm",0
              End If
            End Select
    End Select
End Function

thumbsup2  Wow, I'm having amnesia and deja vu at the same time.
                         I think I've forgotten this before.


Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close