CodyBarrett Posted December 27, 2008 Posted December 27, 2008 is there a function like fileopendialog() but with fonts? like most programs you can change the font\color\size? is there a function to have that box come up and save the settings into a gui [size="1"][font="Tahoma"][COMPLETED]-----[FAILED]-----[ONGOING]VolumeControl|Binary Converter|CPU Usage| Mouse Wrap |WinHide|Word Scrammbler|LOCKER|SCREEN FREEZE|Decisions Decisions|Version UDF|Recast Desktop Mask|TCP Multiclient EXAMPLE|BTCP|LANCR|UDP serverless|AIOCR|OECR|Recast Messenger|AU3C|Tik-Tak-Toe|Snakes & Ladders|BattleShips|TRON|SNAKE_____________________[u]I love the Helpfile it is my best friend.[/u][/font][/size]
Zedna Posted December 27, 2008 Posted December 27, 2008 #Include <Misc.au3> _ChooseFont() Resources UDF ResourcesEx UDF AutoIt Forum Search
CodyBarrett Posted December 27, 2008 Author Posted December 27, 2008 thanks lol [size="1"][font="Tahoma"][COMPLETED]-----[FAILED]-----[ONGOING]VolumeControl|Binary Converter|CPU Usage| Mouse Wrap |WinHide|Word Scrammbler|LOCKER|SCREEN FREEZE|Decisions Decisions|Version UDF|Recast Desktop Mask|TCP Multiclient EXAMPLE|BTCP|LANCR|UDP serverless|AIOCR|OECR|Recast Messenger|AU3C|Tik-Tak-Toe|Snakes & Ladders|BattleShips|TRON|SNAKE_____________________[u]I love the Helpfile it is my best friend.[/u][/font][/size]
CodyBarrett Posted December 27, 2008 Author Posted December 27, 2008 (edited) ok now when i go Change font color as in _choosecolor() nothing happens (i know the _choosefont() has a font color but idk i like _choosecolor() dialog box better. anyway whats wrong with this func Func _Change_Font_Color () $fontcolor = _ChooseColor() GUICtrlSetColor($Console & $Send, $Fontcolor) EndFunc BTW it doesnt even pop up the dialogbox so im thinging \$fontcolor = _ChooseColor() is where the problem is, any ideasd? Edited December 27, 2008 by bob00037 [size="1"][font="Tahoma"][COMPLETED]-----[FAILED]-----[ONGOING]VolumeControl|Binary Converter|CPU Usage| Mouse Wrap |WinHide|Word Scrammbler|LOCKER|SCREEN FREEZE|Decisions Decisions|Version UDF|Recast Desktop Mask|TCP Multiclient EXAMPLE|BTCP|LANCR|UDP serverless|AIOCR|OECR|Recast Messenger|AU3C|Tik-Tak-Toe|Snakes & Ladders|BattleShips|TRON|SNAKE_____________________[u]I love the Helpfile it is my best friend.[/u][/font][/size]
Zedna Posted December 27, 2008 Posted December 27, 2008 Post more code (simple reproducing script). What does $Console & $Send mean? Resources UDF ResourcesEx UDF AutoIt Forum Search
CodyBarrett Posted December 27, 2008 Author Posted December 27, 2008 lol sorry bout that here is my tcp server code (stolen from john2004 and reedited*SHHH*) expandcollapse popup#Include <GUIConstantsEx.Au3> #Include <WindowsConstants.Au3> #Include <EditConstants.Au3> #Include <StaticConstants.Au3> #Include <Misc.Au3> #Include <GUIEdit.Au3> #Include <Date.Au3> Opt ('GUIOnEventMode','1') TcpStartUp () Global $Last Global $Server_IP = IniRead ('Server.ini','#Server','Server_IP','') If IniRead ('Server.ini','#Server','Lan_Mode','') = 'True' Then $Server_IP = @IpAddress1 Global $Server_Port = IniRead ('Server.ini','#Server','Server_Port','') Global $Username = IniRead ('Server.ini','#Server','Username','') Global $Connected_Socket = ('-1') Global $Server = TcpListen ($Server_IP, $Server_Port, '1') If $Server = ('-1') Then Exit MsgBox ('16','Error Code 01','Cannot Start Server On IP : ' & $Server_IP & ', Port : ' & $Server_Port, '0') $GUI = GUICreate ('TCP Chat Server - Started On IP : ' & $Server_IP & ', Port : ' & $Server_Port ,'700','500','-1','-1','-1',BitOR('128', $WS_EX_TOPMOST )) GUISetOnEvent ($GUI_EVENT_CLOSE, '_Exit') $File = GUICtrlCreateMenu('File') $Change = GUICtrlCreateMenu('Change',$File) $Exit = GUICtrlCreateMenuItem('Exit',$File) GUICtrlSetOnEvent($Exit,'_Exit') $Font = IniRead('Server.ini','#Server', 'Font_Name', '') $Font_C = IniRead('Server.ini','#Server', 'Font_Color', '') $FontColor = ('0') $C_Font_C = GUICtrlCreateMenuItem('Font Color',$Change) GUISetOnEvent ($C_Font_C, '_Change_Font_Color') $Bckgrnd_CC = IniRead('Server.ini','#Server', 'Console_Color', '') $Bckgrnd_CS = IniRead('Server.ini','#Server', 'Send_Color', '') $C_Bckgrnd_C = GUICtrlCreateMenuItem('Console Background Color',$Change) $S_Bckgrnd_C = GUICtrlCreateMenuItem('Send Background Color',$Change) $Input = GUICtrlCreateInput ($Username, '245','5','200','20','1') GUICtrlSetFont ($Input, '9','','',$Font) $Console = GUICtrlCreateEdit ('','10','30','680','300','2103360') GUICtrlSetFont ($Console, '10','','',$Font) GUICtrlSetBkColor ($Console, $Bckgrnd_CC) GUICtrlSetColor ($Console, $Font_C) $Send = GUICtrlCreateEdit ('','10','340','680','130','2101248') GUICtrlSetFont ($Send, '10','','',$Font) GUICtrlSetColor ($Send, $Font_C) GUICtrlSetBkColor ($Send, $Bckgrnd_CS) GUICtrlSetState ($Send, $GUI_FOCUS) GUISetState (@SW_SHOW, $GUI) _Console_Log ('[' & _NowTime () & '] Loading Settings...' & ' IP : ' & $Server_IP & ' Port : ' & $Server_Port &' Username : ' & $Username) _Console_Log ('[' & _NowTime () & '] Server Has Started. - Waiting For Client To Connect . . .') _Accept_Connection () While ('1') If WinActive ($GUI) And _IsPressed ('0D') = '1' Then _Send () $Data = TcpRecv ($Connected_Socket, '1000000') If StringInStr ($Data, '/Client.Disconnected') == '1' Then _Disconnected () ElseIf $Data <> '' Then _Console_Log ('[' & _NowTime () & '] ' & $Data) EndIf Sleep ('10') WEnd Func _Change_Font_Color () $FontColor = _ChooseColor() GUICtrlSetColor($Console & $Send, $Fontcolor) IniWrite('Server.ini','#Server','Font_Color',$FontColor) EndFunc Func _Send () If GUICtrlRead ($Send) <> '' Then $What_2_Send = GUICtrlRead ($Input) & ' Say(s) : ' & GUICtrlRead ($Send) $Tcp_Send = TcpSend ($Connected_Socket, $What_2_Send) If $Tcp_Send >= '1' Then _Console_Log ('[' & _NowTime () & '] ' & $What_2_Send) Else _Disconnected () EndIf EndIf GUICtrlSetData ($Send, '') EndFunc Func _Console_Log ($Data) FileWriteLine (@TempDir & '\Server.log', $Data) $Read = FileRead (@TempDir & '\Server.log') GUICtrlSetData ($Console, $Read) _GUICtrlEdit_LineScroll ($Console, '0', _GUICtrlEdit_GetLineCount ($Console) - '1') EndFunc Func _Accept_Connection () Do Sleep ('10') $Connected_Socket = TcpAccept ($Server) Until $Connected_Socket <> ('-1') _Console_Log ('[' & _NowTime () & '] Client Has Connected.') EndFunc Func _Disconnected () TcpCloseSocket ($Connected_Socket) $Connected_Socket = ('-1') _Console_Log ('[' & _NowTime () & '] Client Has Disconnected.') Sleep ('500') _Console_Log ('[' & _NowTime () & '] Waiting For Client To Connect...') _Accept_Connection () EndFunc Func _Exit () $Username = GUICtrlRead ($Input) Exit EndFunc Func OnAutoItExit () TcpSend ($Connected_Socket, '/Disconnect') IniWrite ('Server.ini','#Server','Username',' ' & $Username) If FileExists (@TempDir & '\Server.log') Then $Msg = MsgBox (BitOr ('32','4'),'Delete?','Would You Like To Delete The Server Logs?','0') If $Msg <> '7' Then FileDelete (@TempDir & '\Server.log') EndIf EndFunc [size="1"][font="Tahoma"][COMPLETED]-----[FAILED]-----[ONGOING]VolumeControl|Binary Converter|CPU Usage| Mouse Wrap |WinHide|Word Scrammbler|LOCKER|SCREEN FREEZE|Decisions Decisions|Version UDF|Recast Desktop Mask|TCP Multiclient EXAMPLE|BTCP|LANCR|UDP serverless|AIOCR|OECR|Recast Messenger|AU3C|Tik-Tak-Toe|Snakes & Ladders|BattleShips|TRON|SNAKE_____________________[u]I love the Helpfile it is my best friend.[/u][/font][/size]
Zedna Posted December 27, 2008 Posted December 27, 2008 Func _Change_Font_Color () $fontcolor = _ChooseColor() GUICtrlSetColor($Console, $Fontcolor) GUICtrlSetColor($Send, $Fontcolor) EndFunc Resources UDF ResourcesEx UDF AutoIt Forum Search
CodyBarrett Posted December 27, 2008 Author Posted December 27, 2008 (edited) it doesnt even show the _choosecolor() dialog box, or how does func work? PS ILL TRY IT EDIT nope still same thing i dont think it matters if there is an & in the middle Edited December 27, 2008 by bob00037 [size="1"][font="Tahoma"][COMPLETED]-----[FAILED]-----[ONGOING]VolumeControl|Binary Converter|CPU Usage| Mouse Wrap |WinHide|Word Scrammbler|LOCKER|SCREEN FREEZE|Decisions Decisions|Version UDF|Recast Desktop Mask|TCP Multiclient EXAMPLE|BTCP|LANCR|UDP serverless|AIOCR|OECR|Recast Messenger|AU3C|Tik-Tak-Toe|Snakes & Ladders|BattleShips|TRON|SNAKE_____________________[u]I love the Helpfile it is my best friend.[/u][/font][/size]
Zedna Posted December 27, 2008 Posted December 27, 2008 (edited) $GUI = GUICreate ('TCP Chat Server - Started On IP : ' & $Server_IP & ', Port : ' & $Server_Port ,'700','500','-1','-1','-1',BitOR('128', $WS_EX_TOPMOST )) You use $WS_EX_TOPMOST style for main GUI so choosecolor dialog is probably behind main GUI. Edited December 27, 2008 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search
CodyBarrett Posted December 27, 2008 Author Posted December 27, 2008 nope not even behind its like the funtion isnt even being called, its wierd i dont get it lol [size="1"][font="Tahoma"][COMPLETED]-----[FAILED]-----[ONGOING]VolumeControl|Binary Converter|CPU Usage| Mouse Wrap |WinHide|Word Scrammbler|LOCKER|SCREEN FREEZE|Decisions Decisions|Version UDF|Recast Desktop Mask|TCP Multiclient EXAMPLE|BTCP|LANCR|UDP serverless|AIOCR|OECR|Recast Messenger|AU3C|Tik-Tak-Toe|Snakes & Ladders|BattleShips|TRON|SNAKE_____________________[u]I love the Helpfile it is my best friend.[/u][/font][/size]
Zedna Posted December 27, 2008 Posted December 27, 2008 Try this example from helpfile: expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Misc.au3> Opt('MustDeclareVars', 1) _Color_Example() Func _Color_Example() Local $GUI, $Btn_COLORREF, $Btn_BGR, $Btn_RGB, $iMemo $GUI = GUICreate("_ChooseColor() Example", 400, 300) $iMemo = GUICtrlCreateEdit("", 2, 55, 396, 200, BitOR($WS_VSCROLL, $WS_HSCROLL)) GUICtrlSetFont($iMemo, 10, 400, 0, "Courier New") $Btn_COLORREF = GUICtrlCreateButton("COLORREF", 70, 10, 80, 40) $Btn_BGR = GUICtrlCreateButton("BGR", 160, 10, 80, 40) $Btn_RGB = GUICtrlCreateButton("RGB", 250, 10, 80, 40) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $Btn_COLORREF _ShowChoice($GUI, $iMemo, 0, _ChooseColor(0, 255, 0, $GUI), "COLORREF color of your choice: ") Case $Btn_BGR _ShowChoice($GUI, $iMemo, 1, _ChooseColor(1, 0x808000, 1, $GUI), "BGR Hex color of your choice: ") Case $Btn_RGB _ShowChoice($GUI, $iMemo, 2, _ChooseColor(2, 0x0080C0, 2, $GUI), "RGB Hex color of your choice: ") EndSwitch WEnd EndFunc ;==>_Color_Example Func _ShowChoice($GUI, $iMemo, $Type, $Choose, $sMessage) Local $oldOpt, $cr If $Choose <> -1 Then ;~ $oldOpt = Opt('ColorMode', 0) ;Colors are defined as RGB ;~ If $Type = 1 Then Opt('ColorMode', 1) ;Colors are defined as BGR If $Type = 0 Then ; convert COLORREF to RGB for this example $cr = Hex($Choose, 6) GUISetBkColor('0x' & StringMid($cr, 5, 2) & StringMid($cr, 3, 2) & StringMid($cr, 1, 2), $GUI) Else GUISetBkColor($Choose, $GUI) EndIf GUICtrlSetData($iMemo, $sMessage & $Choose & @CRLF, 1) ;~ Opt('ColorMode', $oldOpt) ; reset colormode Else GUICtrlSetData($iMemo, "User Canceled Selction" & @CRLF, 1) EndIf EndFunc ;==>_ShowChoice Resources UDF ResourcesEx UDF AutoIt Forum Search
CodyBarrett Posted December 27, 2008 Author Posted December 27, 2008 (edited) i take it your sugesting i try switch case $Fontcolor endswitch JUST AN EXAMPLE i will lookinto it EDIT alright BTW just THIS funtion is not working and if the user goes into the server.ini then they can manually change all the colors and the next time the server starts the colors with take place THIS function doesnt even show the color dialog box EVEN when i do this INSTEAD of the func While ('1') $M = GUIGetMsg() If $M = $C_Font_C Then $fontcolor = _ChooseColor() GUICtrlSetColor($Console, $Fontcolor) GUICtrlSetColor($Send, $Fontcolor) IniWrite('Server.ini','#Server','Font_Color',$FontColor) EndIf same thing happens i wonder why? Edited December 27, 2008 by bob00037 [size="1"][font="Tahoma"][COMPLETED]-----[FAILED]-----[ONGOING]VolumeControl|Binary Converter|CPU Usage| Mouse Wrap |WinHide|Word Scrammbler|LOCKER|SCREEN FREEZE|Decisions Decisions|Version UDF|Recast Desktop Mask|TCP Multiclient EXAMPLE|BTCP|LANCR|UDP serverless|AIOCR|OECR|Recast Messenger|AU3C|Tik-Tak-Toe|Snakes & Ladders|BattleShips|TRON|SNAKE_____________________[u]I love the Helpfile it is my best friend.[/u][/font][/size]
CodyBarrett Posted December 27, 2008 Author Posted December 27, 2008 (edited) OMG STUPID STUPID ERROR lol what i had was guisetonevent() what i needed was guiCTRLsetonevent() 4 letter difference made my script not work (now it does) and btw how do you get the _choosefont() to be ontop? EDIT lol and for some reason some of my colors are inverted why? how do i fix it? ex: blue=red , red=blue, lightblue=pink, ect.... black=black, white=white,gray=gray Edited December 27, 2008 by bob00037 [size="1"][font="Tahoma"][COMPLETED]-----[FAILED]-----[ONGOING]VolumeControl|Binary Converter|CPU Usage| Mouse Wrap |WinHide|Word Scrammbler|LOCKER|SCREEN FREEZE|Decisions Decisions|Version UDF|Recast Desktop Mask|TCP Multiclient EXAMPLE|BTCP|LANCR|UDP serverless|AIOCR|OECR|Recast Messenger|AU3C|Tik-Tak-Toe|Snakes & Ladders|BattleShips|TRON|SNAKE_____________________[u]I love the Helpfile it is my best friend.[/u][/font][/size]
Zedna Posted December 27, 2008 Posted December 27, 2008 lol and for some reason some of my colors are inverted why? how do i fix it?ex: blue=red , red=blue, lightblue=pink, ect.... black=black, white=white,gray=gray Look into helpfile at parametres of _ChooseColor() Resources UDF ResourcesEx UDF AutoIt Forum Search
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