Jump to content

Combo Box In Gui


Recommended Posts

I'm working with a Combo Box in my GUI Script.

Opt("GUINotifyMode", 1)
GUICreate("TxtMsg / Blat messages to mobile phones", 300, 200)
  GUISetControl("Label", "Address (phone number@provider address):", 10, 10)
  $address = GUISetControl("Combo", "1235556789@mobile.mycingular.net", 10, 25, 280)
  $abook = FileReadLine("C:\TxtMsg\ABook.txt", 1)
  GUISetControlData($abook, $abook)
  GUISetControl("Label", "Subject:", 10, 60)
  $subj = GUISetControl("Input", "Type your subject here", 10, 75, 280)
  GUISetControl("Label", "Message:", 10, 110)
  $msg = GUISetControl("Input", "Type your message here", 10, 125, 280)
  $blat = GUISetControl("Button", "Send", 10, 160, 100)
  $quit = GUISetControl("Button", "Exit", 190, 160, 100)
GUIShow()

In the Line $abook = FileReadLine("C:\TxtMsg\Abook.txt", 1) Abook.txt is a a Text file with only one line containing data seperated by a "|". But it dosen't populate my Combo box at Run Time.

Any Idea?

Thanks,

Ian

Ohh, I don't think I understand the controlref...

"Blessed be the name of the Lord" - Job 1:21Check out Search IMF

Link to comment
Share on other sites

  • Developers

I'm working with a Combo Box in my GUI Script.

[in the Line $abook = FileReadLine("C:\TxtMsg\Abook.txt", 1) Abook.txt is a a Text file with only one line containing data seperated by a "|".  But it dosen't populate my Combo box at Run Time.

Any Idea?

Thanks,

Ian

Ohh, I don't think I understand the controlref...

<{POST_SNAPBACK}>

:ph34r: Should this line:

GUISetControlData($abook, $abook)

Be

GUISetControlData($address , $abook)

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Should this line:

GUISetControlData($abook, $abook)

Be

GUISetControlData($address , $abook)

You're right about that. Somtimes I miss the simple things.

But it still dosen't work. And I even tried changing the second $abook to some static data. (Ex. "Item1|Item2")

$address = GUISetControl("Combo", "1235556789@mobile.mycingular.net", 10, 25, 280)
  $abook = FileReadLine("C:\TxtMsg\ABook.txt", 1)
  GUISetControlData($address, "Item1|Item2")

"Blessed be the name of the Lord" - Job 1:21Check out Search IMF

Link to comment
Share on other sites

  • Developers

Works fine for me.... it only doesn't showa default value since thats not specified....

try this one:

GUICreate("TxtMsg / Blat messages to mobile phones", 300, 200)
GUISetControl("Label", "Address (phone number@provider address):", 10, 10)
$address = GUISetControl("Combo", "1235556789@mobile.mycingular.net", 10, 25, 280)
GUISetControlData($address, "Item1|Item2","Item1")
GuiShow()
GUIWaitClose()

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

I set the default Item (GUISetControlData($address, "Item1|Item2","Item1")). Now the Combo Box displays "Item1" but it still dosen't have a any more items listed in the Drop-down box.

"Blessed be the name of the Lord" - Job 1:21Check out Search IMF

Link to comment
Share on other sites

  • Developers

I set the default Item (GUISetControlData($address, "Item1|Item2","Item1")).  Now the Combo Box displays "Item1" but it still dosen't have a any more items listed in the Drop-down box.

<{POST_SNAPBACK}>

Are you running 98? if so try setting the height of the combo box to 80..

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Developers

Windows 2000

<{POST_SNAPBACK}>

Well i am running xp and it work fine ... are you just runnin the script i posted or the one you posted with changes??

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Thanks for all your help.

Here is my whole script:

Opt("GUINotifyMode", 1)
GUICreate("TxtMsg / Blat messages to mobile phones", 300, 200)
  GUISetControl("Label", "Address (phone number@provider address):", 10, 10)
  $address = GUISetControl("Combo", "1235556789@mobile.mycingular.net", 10, 25, 280)
  $abook = FileReadLine("C:\TxtMsg\ABook.txt", 1)
  GUISetControlData($address, "Item1|Item2", "Item1")
  GUISetControl("Label", "Subject:", 10, 60)
  $subj = GUISetControl("Input", "Type your subject here", 10, 75, 280)
  GUISetControl("Label", "Message:", 10, 110)
  $msg = GUISetControl("Input", "Type your message here", 10, 125, 280)
  $blat = GUISetControl("Button", "Send", 10, 160, 100)
  $quit = GUISetControl("Button", "Exit", 190, 160, 100)
GUIShow()

While 1
  $x = GuiMsg()

  Select
  Case $x = $blat
    $address1 = GuiRead($address)
    $subj1 = GuiRead($subj)
    $msg1 = GuiRead($msg)
    FileOpen("C:\TxtMsg\Msg.txt", 2)
    FileWrite("C:\TxtMsg\Msg.txt", $msg1)
    RunWait(@ComSpec & " /c " & "blat C:\TxtMsg\Msg.txt -to " & $address1 & " -subject " & $subj1, "", @SW_HIDE)
    MsgBox(0, "TxtMsg / Blat messages to mobile phones", "Message: " & $msg1 & " Sent to User: " & $address1)

  Case $x = $quit
    Exit
  EndSelect
WEnd

"Blessed be the name of the Lord" - Job 1:21Check out Search IMF

Link to comment
Share on other sites

  • Developers

Ahhh.. think i know what the problem is...

The Label above the bombo box is overlaying it ... try it with thee lines:

GUISetControl("Label", "Address (phone number@provider address):", 10, 10)

$address = GUISetControl("Combo", "1235556789@mobile.mycingular.net", 10, 35, 280)

:ph34r:

Edited by JdeB

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Thanks again JdeB, But that still didn't do it.

You just wanted be to change the "25" to a "35" in the line: $address = GUISetControl("Combo", "1235556789@mobile.mycingular.net", 10, 35, 280)

I tried that but my combo box still dosen't have any options in it...

Thanks again,

Ian

-> I thought that the Combo Box might not have enough room to expand b/c the of the controls below it, so I tried moving them all down by "100" but that didn't help either. Just thought I'd add that. It looks like the CB just isn't accepting the data.

Edited by ioliver

"Blessed be the name of the Lord" - Job 1:21Check out Search IMF

Link to comment
Share on other sites

  • Developers

Thanks again JdeB, But that still didn't do it.

You just wanted be to change the "25" to a "35" in the line: $address = GUISetControl("Combo", "1235556789@mobile.mycingular.net", 10, 35, 280)

I tried that but my combo box still dosen't have any options in it...

Thanks again,

Ian

<{POST_SNAPBACK}>

:ph34r: you mean it doesn't dropdown when clicking the right arrow of the combobox?? ... did you try the down arrow to see if they are there ???

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

I hadn't tried the (Down Arrow), but I just did and the options are there...

But why won't it drop down?

Thanks again, at least that's progress.

-> And I just tried the FileRead part using the Variable $abook and that's working, still no drop down box. Thanks again.

Edited by ioliver

"Blessed be the name of the Lord" - Job 1:21Check out Search IMF

Link to comment
Share on other sites

  • Developers

I hadn't tried the (Down Arrow), but I just did and the options are there...

But why won't it drop down?

Thanks again, at least that's progress.

<{POST_SNAPBACK}>

Did you ever try the suggestion i made to set the height of the combo box?

I know its an issue on win9X..... maybe also on Win2K ....

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Setting the height to "80" works, but everyting on the form gets pushed down.

Here's the new code if you want to try it:

Opt("GUINotifyMode", 1)
GUICreate("TxtMsg / Blat messages to mobile phones", 300, 200)
  GUISetControl("Label", "Address (phone number@provider address):", 10, 10)
  $address = GUISetControl("Combo", "1235556789@mobile.mycingular.net", 10, 25, 280, 80)
  $abook = FileReadLine("C:\TxtMsg\ABook.txt", 1)
  GUISetControlData($address, $abook)
  GUISetControl("Label", "Subject:", 10, 60)
  $subj = GUISetControl("Input", "Type your subject here", 10, 75, 280)
  GUISetControl("Label", "Message:", 10, 110)
  $msg = GUISetControl("Input", "Type your message here", 10, 125, 280)
  $blat = GUISetControl("Button", "Send", 10, 160, 100)
  $quit = GUISetControl("Button", "Exit", 190, 160, 100)
GUIShow()

While 1
  $x = GuiMsg()

  Select
  Case $x = $blat
    $address1 = GuiRead($address)
    $subj1 = GuiRead($subj)
    $msg1 = GuiRead($msg)
    FileOpen("C:\TxtMsg\Msg.txt", 2)
    FileWrite("C:\TxtMsg\Msg.txt", $msg1)
    RunWait(@ComSpec & " /c " & "blat C:\TxtMsg\Msg.txt -to " & $address1 & " -subject " & $subj1, "", @SW_HIDE)
    MsgBox(0, "TxtMsg / Blat messages to mobile phones", "Message: " & $msg1 & " Sent to User: " & $address1)

  Case $x = $quit
    Exit
  EndSelect
WEnd

Thanks,

Ian

"Blessed be the name of the Lord" - Job 1:21Check out Search IMF

Link to comment
Share on other sites

  • Developers

Setting the height to "80" works, but everyting on the form gets pushed down.

<{POST_SNAPBACK}>

From the helpfile: [height] The height of the control (default is the previous used height).

So add a Height to the next one of 20 like:

$address = GUISetControl("Combo", "1235556789@mobile.mycingular.net", 10, 25, 280, 80)
  $abook = FileReadLine("C:\TxtMsg\ABook.txt", 1)
  GUISetControlData($address, $abook)
  GUISetControl("Label", "Subject:", 10, 60,-1,20)

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...