James Posted January 20, 2007 Posted January 20, 2007 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 Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ
Helge Posted January 20, 2007 Posted January 20, 2007 (edited) How about...If $lastfont <> GUICtrlRead($combo) Then $lastfont = GUICtrlRead($combo) GUICtrlSetFont($combo, -1, -1, -1, $lastfont) EndIfEDIT : forgot something. Also, what about using combo-style $CBS_DROPDOWNLIST,in case you don't want the user to type anything into the combo ? Edited January 20, 2007 by Helge
James Posted January 20, 2007 Author Posted January 20, 2007 I dont understand how that would work, Im using a RichText control. To set a font you have to do: $DocEd1.SelFontName = "Verdana" How could I do that? But instead of Verdana, it will change depending on what the dropdown is. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ
Helge Posted January 20, 2007 Posted January 20, 2007 Ehm... If $lastfont <> GUICtrlRead($combo) Then $lastfont = GUICtrlRead($combo) $DocEd1.SelFontName = $lastfont EndIf
James Posted January 20, 2007 Author Posted January 20, 2007 Where do I put this? Because it doesnt work in a Case obviously. Also it gives me a warning: C:\BetaPad\V2\AVE2.au3(432,17) : WARNING: $lastfont: possibly used before declaration. If $lastfont <> ~~~~~~~~~~~~~^ Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ
Helge Posted January 20, 2007 Posted January 20, 2007 Declare $lastfont on top of your script and put the If-statement in your message/keep-alive loop.
James Posted January 20, 2007 Author Posted January 20, 2007 Ok, so at the top of my script I put $lastfont = "" and then: where do i put the script? in the While statement? Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ
Moderators SmOke_N Posted January 20, 2007 Moderators Posted January 20, 2007 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.
James Posted January 20, 2007 Author Posted January 20, 2007 Yes, I know. I have experimented, the only way I can make it work is with a button. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ
Moderators SmOke_N Posted January 20, 2007 Moderators Posted January 20, 2007 (edited) 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.SelFontName2. 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 January 20, 2007 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.
Helge Posted January 20, 2007 Posted January 20, 2007 (edited) 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 tothe obvious fact that you found this issue hard to solve. Seems like I shouldn't assume thingslike 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 January 20, 2007 by Helge
James Posted January 20, 2007 Author Posted January 20, 2007 It's ok. I didnt explain properly. Im gonna have to get RazerM to do it because he is the only one that knows the controls for setting the doc stuff at the moment. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ
Helge Posted January 20, 2007 Posted January 20, 2007 From what you've explained in this topic it should work, so what's so difficult ?
James Posted January 20, 2007 Author Posted January 20, 2007 Well we have all these .SelText, .Text etc and its all confusing when doing this. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ
Helge Posted January 20, 2007 Posted January 20, 2007 $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...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now