Jump to content

DropDown Boxes


James
 Share

Recommended Posts

Hiya,

I am just wandering how I could make:

$FontCombo = GUICtrlCreateCombo("Arial", 403, 11, 100, 22)
GUICtrlSetData(-1, "Arial Bold|Comic Sans MS|Courier New|Tahoma|Times New Roman")

Set itself to the font chosen without having to press a button to select it.

E.G. You select a font, and it automatically changes.

Secure

Link to comment
Share on other sites

  • Moderators

Ok, so at the top of my script I put

$lastfont = ""

and then:

where do i put the script? in the While statement?

Why don't you just experiment... we shouldn't have to walk your hand all the way through. I would assume it would go where ever you are calling the function that needs it.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

  • Moderators

Yes, I know. I have experimented, the only way I can make it work is with a button.

1. In your first post, you ask a question that assumes anyone knows you were using: $DocEd1.SelFontName

2. Now you are assuming that anyone even knows what your script is, to even want to help you.

I see you are using betapad\something, but I certainly wouldn't go out of my way to download your script to help. If you want help, recreate a "small" example that shows the issue you are having, and maybe someone can show you where it would go.

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

I said where you should put it although it shouldn't be needed. Even after I said it you didn't know.

EDIT : I thought automatically that if you selected a combo it wouldn't affect GUIGetMsg, due to

the obvious fact that you found this issue hard to solve. Seems like I shouldn't assume things

like that.

#include <GUIConstants.au3>

$sLastFont = ""

GUICreate("", 300, 300)
$nEdit = GUICtrlCreateEdit("Was it really that hard ?", 10, 10, 280, 250)
$nCombo = GUICtrlCreateCombo("", 10, 270, 280, 20, $CBS_DROPDOWNLIST)
GUICtrlSetData(-1, "Arial Bold|Comic Sans MS|Courier New|Tahoma|Times New Roman")

GUISetState()

While 1
    $iMsg = GUIGetMsg()
    
    Switch $iMsg
        Case $GUI_EVENT_CLOSE
            Exit
            
        Case $nCombo
            GUICtrlSetFont($nEdit, -1, -1, -1, GUICtrlRead($nCombo))
        ;$DocEd1.SelFontName = GUICtrlRead($nCombo)
    EndSwitch
WEnd
Edited by Helge
Link to comment
Share on other sites

$DocEd1.SelFontName = "Verdana"

If you're able to put that line in your script and make it work, I can't really see how more difficult it

would be to just make the font-changing be triggered by the selecting of the combo-items, and to

change that line from "Verdana" to a simple GUICtrlRead...

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...