combo boxs ??

I am trying to figure out how to get two combo boxs to return a result to a text field or dialog, I have laboured to figure this out for myself but have failed.
The idea behind this is to have two combo boxs, one with 1,2,3 in it, the other with a,b,c, when a combination from both boxs is selected a result is given that corresponds to the selection.
I am trying to build this in AppleScript Studio, with a UI
Any help would be greatfully appreciated.

Budgie :?

Greetings, Budgie.

In the following code, when a button “Eval” is clicked, it takes the current value from two combo boxes, makes them into one string, and then displays the result in a text field. This should give you all of the syntax you need to gather and manipulate the combo box strings.

on clicked theObject
	if name of theObject is "Eval" then
		tell window "theWindow"
			set Combo1 to (content of combo box "ComboBox1") as string
			set Combo2 to (content of combo box "ComboBox2") as string
			set theOutput to (Combo1 & Combo2) as string

			set content of text field "Output" to theOutput
		end tell
	end if
end clicked

Hope that’s what you’re looking for.


I should have laboured longer, found some info further into the forum, have adapted the script to suit my purpose, problem im having now is that the dialog box that is returned is to small for the amount of information I want to put in it, how can I get this script to dispaly a sheet in a window of the information returned?
Ive supplied my code,

on clicked theObject
	if name of theObject is "Info" then
		tell window "Main"
			set theMach to name of current menu item of popup button "theMach"
			set theEnve to name of current menu item of popup button "theEnve"
		end tell
		(* Information Results *)
		if (theMach is "1") and (theEnve is "A") then
			display dialog "1 & A"
		else if (theMach is "1") and (theEnve is "B") then
			display dialog "1 & B"
			display dialog "Wrong"
		end if
	end if
end clicked

Regarding the size of the dialog, you have no control over the size of the standard additions dialogs. They’re one size fit’s all. 8)

If that doesn’t do if for you, you’ll have to create a custom panel object in Interface Builder, adding text fields, buttons, etc. to get a “dialog-like” appearance and then display the panel attached to the window. For example…

set content of text field "myDialogText" of window "myPanel" to "1 & A"
display (window "myPanel") attached to window "Main"

You can attach any panel, including dialogs, open and save panels, and custom panels to any window not currently displaying a panel by using the “…attached to…” property shown above. To simply display a basic dialog attached to your window main, you could change one of your existing lines to something like…

display dialog "1 & A" attached to window "Main"

Hope that helps…


Thanks for the help Jobu,
I was just sending my script of with another question when my e/mail went of telling me thier was a message.
Can what I am asking in my last message be achieved, or do I change as you have shown in your script and make the result display in a text field?


Thats fantastic j, really appreciate the help,
out of all the sites I asked for help from this was the only place I got it!

I have used the first of the examples supplied from your last post and works a treat, it’s amazing how clear things become when you see them written down.

again thanks
Budgie :smiley: