madmorgan Posted February 9, 2010 Share Posted February 9, 2010 hello, im building an app that lets the user chose the size and colour of text and back ground but i hit a probelm i can set the size of text fine but when i try to change the fount as well to a different one it changes the fount and the size back. please look and tell me were i have gone wrong, here is my code. expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> $temp = 8 ;BACKGROUND COLOUR $Form2 = GUICreate("SETTINGS", 403, 432, 500, 143) $Group1 = GUICtrlCreateGroup("Back Ground Colour", 16, 16, 185, 97) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x000000) $RED = GUICtrlCreateButton("RED", 24, 40, 75, 25) GUICtrlSetBkColor(-1, 0xFF0000) $GREEN = GUICtrlCreateButton("GREEN", 112, 40, 75, 25) GUICtrlSetBkColor(-1, 0x00FF00) $YELLOW = GUICtrlCreateButton("YELLOW", 24, 72, 75, 25) GUICtrlSetBkColor(-1, 0xFFFF00) $BLUE = GUICtrlCreateButton("BLUE", 112, 72, 75, 25) GUICtrlSetBkColor(-1, 0x00FFFF) GUICtrlCreateGroup("", -99, -99, 1, 1) ;TEXT COLOUR $Group2 = GUICtrlCreateGroup("Text Colour", 16, 128, 185, 97) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $REDT = GUICtrlCreateButton("RED", 24, 152, 75, 25) GUICtrlSetBkColor(-1, 0xFF0000) $GREENT = GUICtrlCreateButton("GREEN", 112, 152, 75, 25) GUICtrlSetBkColor(-1, 0x00FF00) $YELLOWT = GUICtrlCreateButton("YELLOW", 24, 184, 75, 25) GUICtrlSetBkColor(-1, 0xFFFF00) $BLUET = GUICtrlCreateButton("BLUE", 112, 184, 75, 25) GUICtrlSetBkColor(-1, 0x00FFFF) GUICtrlCreateGroup("", -99, -99, 1, 1) ;TEXT SIZE $Group3 = GUICtrlCreateGroup("Text Size", 216, 16, 169, 209) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $Size1 = GUICtrlCreateButton("SIZE 10", 264, 40, 75, 25) GUICtrlSetFont(-1, 10, 800, 0, "") $Size2 = GUICtrlCreateButton("SIZE 14", 256, 80, 91, 25) GUICtrlSetFont(-1, 14, 800, 0, "") $Size3 = GUICtrlCreateButton("SIZE 18", 248, 120, 107, 33) GUICtrlSetFont(-1, 18, 800, 0, "") $Size4 = GUICtrlCreateButton("SIZE 24", 240, 168, 123, 41) GUICtrlSetFont(-1, 24, 800, 0, "") GUICtrlCreateGroup("", -99, -99, 1, 1) ;STYLE $Group4 = GUICtrlCreateGroup("Style", 16, 240, 361, 105) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $STYLE1 = GUICtrlCreateButton("STYLE1", 24, 264, 75, 25) GUICtrlSetFont(-1, 8, 800, 0, "Napa Heavy SF") $STYLE2 = GUICtrlCreateButton("STYLE2", 112, 264, 75, 25) GUICtrlSetFont(-1, 8, 800, 0, "Microsoft Sans Serif") $STYLE3 = GUICtrlCreateButton("STYLE3", 200, 264, 75, 25) GUICtrlSetFont(-1, 8, 800, 0, "Lucida Sans Unicode") $STYLE4 = GUICtrlCreateButton("STYLE4", 288, 264, 75, 25) GUICtrlSetFont(-1, 8, 800, 0, "Lucida Console") $STYLE5 = GUICtrlCreateButton("STYLE5", 24, 304, 75, 25) GUICtrlSetFont(-1, 8, 400, 0, "Invite SF") $STYLE6 = GUICtrlCreateButton("STYLE6", 112, 304, 75, 25) GUICtrlSetFont(-1, 8, 800, 0, "Georgia") $STYLE7 = GUICtrlCreateButton("STYLE7", 200, 304, 75, 25) GUICtrlSetFont(-1, 8, 800, 0, "Fixedsys") $STYLE8 = GUICtrlCreateButton("STYLE8", 288, 304, 75, 25) GUICtrlSetFont(-1, 8, 800, 0, "Courier New") GUICtrlCreateGroup("", -99, -99, 1, 1) ;Preview $CLOSE = GUICtrlCreateButton("CLOSE", 24, 360, 75, 25) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $Input1 = GUICtrlCreateInput("Preview", 128, 360, 249, 40) GUICtrlSetFont(-1, $temp, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x000000) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $STYLE1 GUICtrlSetFont($Input1, $temp,"Napa Heavy SF") ;TEXT SIZE Case $Size1 $temp = GUICtrlSetFont($Input1,10) Case $Size2 $temp = GUICtrlSetFont($Input1,14) Case $Size3 $temp = GUICtrlSetFont($Input1,18) Case $Size4 $temp = GUICtrlSetFont($Input1,24) ;TEXT COLOUR CONTROLS Case $REDT GUICtrlSetColor($Input1,0xFF0000) Case $BLUET GUICtrlSetColor($Input1,0x00FFFF) Case $GREENT GUICtrlSetColor($Input1,0x00FF00) Case $YELLOWT GUICtrlSetColor($Input1,0xFFFF00) ;Back Ground Controls Case $RED GUISetBkColor(0xFF0000) Case $GREEN GUISetBkColor(0x00FF00) Case $BLUE GUISetBkColor(0x00FFFF) Case $YELLOW GUISetBkColor(0xFFFF00) EndSwitch WEnd Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 9, 2010 Moderators Share Posted February 9, 2010 madmorgan,You have the correct syntax for GUICtrlSetFont when you change the size, why do you not use the correct syntax when changing the font itself?From the Help file:"GUICtrlSetFont (controlID, size [, weight [, attribute [, fontname[, quality]]]] )"Hint: You need to set all the intervening parameters to Default. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 9, 2010 Moderators Share Posted February 9, 2010 madmorgen,In response to your PM:It does not matter what parameter you want to change - you MUST complete all the parameters in the GUICtrlSetFont up to the one you want to change. So if you want to change the font and nothing else, you do this:GUICtrlSetFont(controlID, Default, Default, Default, fontname)M23P.S. For anyone else reading - do NOT send PMs asking for help, it is considered rude here. Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
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