Creating a listbox - How to?

To all,

A stupid question (I partially know the answer but just in case!).
What is the best/quickest/simplest way of creating a list box to present a list of NX AFU record name to a user and allow them to select one or more.

Thanks

Regards

JXB

Do you have access to the NX blockstyler? or do you want to create your own windows form?

Went for the NX blockstyler option. As I got some help for a very kind soul over the week end
Wrestling with the user selection from a list box at the moment. I am getting the index of the selection but I am looking for the keyword to get the "text of the selection as I'd like to pass an array (of string) containing all the user selections (from the list box) to another function

Thanks
Regards

Unfortunately, I won't be much help here as I do not currently have a license for the NX blockstyler.

That's OK. The following seems to work

Dim theListboxselection() As String

theListboxselection= list_box0.GetSelectedItemStrings

If Ubound(theListboxselection) > 0 Then
For i = Lbound(theListboxselection) to Ubound(theListboxselection)
TheLW.WriteLine("---selection is :" &theListboxselection(i) )
Next

GetonItwithIt(theListboxselection)

Thanks
Regards

The simplest is Snap.UI.Input.GetChoices:

Option Infer On
Imports Snap, Snap.Create, Snap.UI.Input

Public Class MyProgram

Public Shared Sub Main()

Dim cue As String = "Please choose your favorite Beatles"
Dim title As String = "Beatle Chooser"
Dim label As String = "Choose at least two"
Dim beatles As String() = {"John", "Paul", "George", "Ringo" }

Dim choices = GetChoices(beatles, cue, title, label)

For Each index in choices
InfoWindow.WriteLine(beatles(index))
Next

End Sub

End Class

Thanks for the suggestion ciao. I haven't used Snap in anger but the UI builder seem to do the job very nicely.
I haven't figures out which function is executed when the user presses the "Cancel" button as I'd like the theLW to be closed when the GUI is closed! I have tried theLW.Close() in Public Sub Dispose() but nothing. Must be somewhere! There is no function called 'cancel_cb' !!

Regards

JXB

Thanks
Regards

You need to use theLW.CloseWindow().

The .Close() method only closes the text stream, not the window itself.

Can you recommend a place where i can get more info about listbox?

igor
Start with the 'NX Programming tool' help page (NX help). There is a section on Block UI Styler

Regards

JXB

Thanks
Regards

The discussion above is pretty confusing. Some of it is about ListBox (i.e. NXOpen.BlockStyler.ListBox) and some of it is about the Listing Window (NXOpen.ListingWindow). Two completely different animals.