cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Register for our Discovery Summit 2024 conference, Oct. 21-24, where you’ll learn, connect, and be inspired.
Choose Language Hide Translation Bar

Can't identify the problem

Hi ! 

I wanted to generate a list for a user so he ca choose the abscissa he wants (for a graph) here is the script : 

 

// Créer une liste des options pour la liste déroulante
options = {"Supplier", "Supplier_Quarter"};

// Créer une boîte de dialogue personnalisée avec une liste déroulante
dlg = New Window("Sélectionnez une abscisse de travail",
	<<Modal,
	V List Box(
		Text Box("Sélectionnez une valeur parmi la liste déroulante:"),
		comboBox = Combo Box(options),
		H List Box(
// Créer le bouton OK
			Button Box("OK", dlg << Close(comboBox << Get Selected)), 
// Créer le bouton Cancel
			Button Box("Cancel", dlg << Close(""))
		)
	)
);

// Récupérer la sélection de l'utilisateur
selection = dlg << Get Result;


Print("Vous avez sélectionné : " || Char(selection));

Edit (jthi 2024-08-11): added jsl formatting

 

 

Here is the problem : I have a message error : Name Unresolved: Button

 

What do I have to do to make it works without issues ?

1 REPLY 1
jthi
Super User

Re: Can't identify the problem

As you are using modal window, you don't have to close it otherwise. Also dlg doesn't exist after the window has been closed unless you use <<return result. Below is one option what you could do

Names Default To Here(1);

options = {"Supplier", "Supplier_Quarter"};

dlg = New Window("Sélectionnez une abscisse de travail",
	<<Modal,
	<<return result,
	V List Box(
		Text Box("Sélectionnez une valeur parmi la liste déroulante:"),
		comboBox = Combo Box(options),
		H List Box(
			Button Box("OK", selection = comboBox << Get Selected),
			Button Box("Cancel")
		)
	)
);

show(dlg);
if(dlg["Button"] != 1,
	Throw("Cancelled");
);


Print("Vous avez sélectionné : " || Char(selection));
-Jarmo