Getstring with click options

Getstring with click options

seabrahenrique
Advocate Advocate
416 Views
2 Replies
Message 1 of 3

Getstring with click options

seabrahenrique
Advocate
Advocate

Hello guys!

 

Currently i have some functions in my software that get some string by input user, and i use this way:

 

 

Op = ThisDrawing.Utility.GetString(False, "OP? [yes,no]")

 

 

So, my user can type Y for 'yes' or N for 'no' for example.

 

seabrahenrique_1-1663868798284.png

 

But i'd like to do something like that:

 

seabrahenrique_0-1663868749743.png

 

In this way, the usar can type but can also click on the option...

 

How can i do that?

 

Thanks in advance 🙂

 

0 Likes
Accepted solutions (1)
417 Views
2 Replies
Replies (2)
Message 2 of 3

Ed__Jobe
Mentor
Mentor
Accepted solution

GetString is only for returning a string as input, like the a date or filename. For a command prompt, you use the GetKeyword function along with InitializeUserInput. Below is a sample of how to get and test the result. If you format your prompt string according to standard AutoCAD prompting, your keywords will automatically appear as links in the command line. Note the use of spaces, brackets and slashes.

 

 

Public Sub DeleteAllPSLayouts()
    'Deletes all paperspace layouts, leaving
    'a blank Layout1.
    'The model space tab cannot be deleted.
    Dim lyt As AcadLayout
    Dim Response As String
    Dim KeyWords As Variant

    KeyWords = "Yes No"
    ThisDrawing.Utility.InitializeUserInput 6, KeyWords
    Response = ThisDrawing.Utility.GetKeyword(vbCrLf & "Are you sure you want to delete all layouts? [Yes/No] :  Yes")
    If Response = "Yes" Or Response = "" Then
        For Each lyt In ThisDrawing.Layouts
            If lyt.ModelType = False Then
                lyt.Delete
            End If
        Next lyt
    End If
End Sub

 

 

 

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

0 Likes
Message 3 of 3

seabrahenrique
Advocate
Advocate

Perfect @Ed__Jobe!

 

I imagined it would be another function.

 

Thanks again!

0 Likes