to call a custom dialogbox

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • joemo2003
    New Member
    • Feb 2007
    • 142

    to call a custom dialogbox

    Please help.
    I created a custom dialogbox name "DialogBox" . What i want is input values to the dialogbox, and those values appear on a textbox in Visio. After i creat the textbox and the dialogbox, I used "DialogBox.show ", so i can enter values, and I use "ashape as shape", "ashape.Text=us erinput", then how should i defind "userinput" ?

    Thanks
  • Killer42
    Recognized Expert Expert
    • Oct 2006
    • 8429

    #2
    Originally posted by joemo2003
    Please help.
    I created a custom dialogbox name "DialogBox" . What i want is input values to the dialogbox, and those values appear on a textbox in Visio. After i creat the textbox and the dialogbox, I used "DialogBox.show ", so i can enter values, and I use "ashape as shape", "ashape.Text=us erinput", then how should i defind "userinput" ?
    Can we clarify the programming environment in which you are working? Is this VB6? VB.Net? VBA or similar language built into Visio?

    If VB6, I'd suggest that a textbox on the "dialogbox" window would be the way to go.

    Comment

    • joemo2003
      New Member
      • Feb 2007
      • 142

      #3
      could you specify a little more.
      I am using VB6. What i try to do is call the "dialogbox" in the textbox's code. Is there a function "ashape.Text=Di alogbox(xx)"? what should be the "xx" if i want all the input and label show up on the textbox.
      Thanks


      Originally posted by Killer42
      Can we clarify the programming environment in which you are working? Is this VB6? VB.Net? VBA or similar language built into Visio?

      If VB6, I'd suggest that a textbox on the "dialogbox" window would be the way to go.

      Comment

      • Killer42
        Recognized Expert Expert
        • Oct 2006
        • 8429

        #4
        Originally posted by joemo2003
        could you specify a little more.
        I am using VB6. What i try to do is call the "dialogbox" in the textbox's code. Is there a function "ashape.Text=Di alogbox(xx)"? what should be the "xx" if i want all the input and label show up on the textbox.
        From the sound of it, what you ought to do is write a Public Function which shows your dialogue box form (use vbModal on the Show), waits for it to be hidden (by the OK button or whatever on the form), reads the value of the text box on the form, then returns it as the value of the function. So, assuming you have created your form called DialogBox with a text box on it, you could do something like this in a code module...
        Code:
        ' On your DialogBox form, when the Ok or Cancel button is clicked,
        ' copy the button caption into the following global variable then
        ' hide the window.
        Public ButtonClicked As String
        
        Public Function UserResponse() As String
          DialogBox.Show vbModal
          ' Note, because it's a "modal" window, control does not return
          ' here until it is hidden or closed.
          If ButtonClicked = "Ok" then
            UserResponse = DialogBox.Text1.Text
          End If
        End Function
        Then in your code when you want to retrieve user input into your shape caption, just do something like...
        Code:
        aShape.Caption = UserResponse()

        Comment

        • joemo2003
          New Member
          • Feb 2007
          • 142

          #5
          "aShape.Cap tion = UserResponse()" is what i try to figure out. It come out error message "Compile error: Expected array". Do i need to put something in ( )?

          Thanks a again.


          Originally posted by Killer42
          From the sound of it, what you ought to do is write a Public Function which shows your dialogue box form (use vbModal on the Show), waits for it to be hidden (by the OK button or whatever on the form), reads the value of the text box on the form, then returns it as the value of the function. So, assuming you have created your form called DialogBox with a text box on it, you could do something like this in a code module...
          Code:
          ' On your DialogBox form, when the Ok or Cancel button is clicked,
          ' copy the button caption into the following global variable then
          ' hide the window.
          Public ButtonClicked As String
          
          Public Function UserResponse() As String
            DialogBox.Show vbModal
            ' Note, because it's a "modal" window, control does not return
            ' here until it is hidden or closed.
            If ButtonClicked = "Ok" then
              UserResponse = DialogBox.Text1.Text
            End If
          End Function
          Then in your code when you want to retrieve user input into your shape caption, just do something like...
          Code:
          aShape.Caption = UserResponse()

          Comment

          • Killer42
            Recognized Expert Expert
            • Oct 2006
            • 8429

            #6
            Originally posted by joemo2003
            "aShape.Cap tion = UserResponse()" is what i try to figure out. It come out error message "Compile error: Expected array". Do i need to put something in ( )?
            You could try it without the parentheses.

            UserResponse() is the name of the function I described in my earlier message. For this to work it must be accessible. If it's in a code module (not a form) and defined as Public, this should work.

            Unless aShape is an array perhaps - is this the case?

            Oh! One other question. How come your shape control has a Caption property? Mine doesn't.

            Comment

            • joemo2003
              New Member
              • Feb 2007
              • 142

              #7
              Oh, yeah, i am uing .text, not .caption.

              one more question, can u tell me how to conbain "Sub... End Sub" and "Function.. .End Function"?

              Thanks


              Originally posted by Killer42
              You could try it without the parentheses.

              UserResponse() is the name of the function I described in my earlier message. For this to work it must be accessible. If it's in a code module (not a form) and defined as Public, this should work.

              Unless aShape is an array perhaps - is this the case?

              Oh! One other question. How come your shape control has a Caption property? Mine doesn't.

              Comment

              • Killer42
                Recognized Expert Expert
                • Oct 2006
                • 8429

                #8
                Originally posted by joemo2003
                Oh, yeah, i am uing .text, not .caption.

                one more question, can u tell me how to conbain "Sub... End Sub" and "Function.. .End Function"?
                Sorry, I don't understand the question. Could you rephrase it?

                Comment

                • joemo2003
                  New Member
                  • Feb 2007
                  • 142

                  #9
                  Thanks, I got previous part work.
                  Can you help me on two other questions:
                  1) I show the custom dialogbox use the while loop, and there is a combobox in that dialogbox. I need use the last selected value in the drop down manu over and over again, but every time when loop back, the last selected value disppear. How to make the last selected value appear?

                  2) In that dialogbox have "OK" and "Cancle" bottom, I try use the follow code inside the while loop to stop showing the dialogbox, but it didn't work. Can you tell me how to defined the "cancel"?

                  "If Cancel = True Then
                  Unload DialogBox
                  End If"


                  thanks again.

                  Originally posted by Killer42
                  Sorry, I don't understand the question. Could you rephrase it?

                  Comment

                  • joemo2003
                    New Member
                    • Feb 2007
                    • 142

                    #10
                    never mind, i got it.

                    Originally posted by joemo2003
                    Thanks, I got previous part work.
                    Can you help me on two other questions:
                    1) I show the custom dialogbox use the while loop, and there is a combobox in that dialogbox. I need use the last selected value in the drop down manu over and over again, but every time when loop back, the last selected value disppear. How to make the last selected value appear?

                    2) In that dialogbox have "OK" and "Cancle" bottom, I try use the follow code inside the while loop to stop showing the dialogbox, but it didn't work. Can you tell me how to defined the "cancel"?

                    "If Cancel = True Then
                    Unload DialogBox
                    End If"


                    thanks again.

                    Comment

                    Working...