sshrum Posted February 28, 2008 Share Posted February 28, 2008 (edited) I'm writing yet another multimedia player...however, this one is mainly tailored for my own use with touch screens and my extensive media library. I'd like the ability to create GUI profiles; simple, text based config files that I could parse and have create a GUI and associate commands and interact with the various controls that get created. I just started thinking about this and figured I'd ask to see what kind of issues I'd run into if anyone else has tried to do this. My first concern is control creation and then command association Off the top, I'm figuring on a INI styled text file with entries like this: [1024x768] 1=picture,10,10,100,100,play,play.gif 2=picture,10,130,100,100,next,next.gif 3=button,130,10,100,100,open,Open n=etc. <control#>=<control type>,<top>,<left>,<width>,<height>,<command assignment>,<control specifics> I guess what I'm trying to ask is if this is a sensible way to deal with customizable GUIs? Are their any other ideas or ways to accomplish this sort of thing. TIA Edited February 28, 2008 by sshrum Sean Shrum :: http://www.shrum.net All my published AU3-based apps and utilities 'Make it idiot-proof, and someone will make a better idiot' Link to comment Share on other sites More sharing options...
sshrum Posted February 28, 2008 Author Share Posted February 28, 2008 This is what I just whipped up as a initial test that seems to work so far: expandcollapse popup; User definable GUI Test #include <Array.au3> #include <GUIConstants.au3> $iGuiWidth=860+2 $iGuiHeight=1280 + 2 $oGUI = GUICreate("Build-A-GUI", $iGuiWidth, $iGuiHeight, -1, -1); , $WS_POPUP) GuiCtrlSetState(-1,$GUI_DISABLE) $sSkin = "label,,Some text" & @crlf & "button,play,Play" & @crlf & "button,stop,Halt that thing" & @crlf & "button,exit,Ba-bye" & @crlf & "button,foobar,I don't work" $aSkin = StringSplit($sSkin, @lf) Dim $aGUI[$aSkin[0]+1][4] $aGUI[0][0] = $aSkin[0] for $i = 1 to $aSkin[0] $aControl = StringSplit($aSkin[$i],",") for $j = 1 to $aControl[0] $aGUI[$i][$j-1] = $aControl[$j] Next Next For $i = 1 to $aSkin[0] Switch $aGUI[$i][0] case "label" $iResult = GUICtrlCreatelabel($aGUI[$i][2], 100 * $i, 100, 100, 100) $aGUI[$i][3] = $iResult Consolewrite("creating label -> $aGUI[" & $i & "][3] = " & $iResult & @crlf) case "button" $iResult = GUICtrlCreateButton($aGUI[$i][2], 100 * $i, 100, 100, 100) $aGUI[$i][3] = $iResult Consolewrite("creating button -> $aGUI[" & $i & "][3] = " & $iResult & @crlf) EndSwitch Next GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() if $msg > 0 Then Consolewrite("$msg = " & $msg & @crlf) for $i = 1 to $aGUI[0][0] If $msg = $aGUI[$i][3] then Consolewrite("command = " & $aGUI[$i][1] & @crlf) _Command($aGUI[$i][1]) ExitLoop EndIf next EndIf WEnd func _Command($sCommand) Switch $sCommand case "play" msgbox(0,"","Play") case "stop" msgbox(0,"","Stop") case "exit" Exit case Else msgbox(0,"","Unknown command: '" & $sCommand & "'") EndSwitch EndFunc Any input would be appreciated. Sean Shrum :: http://www.shrum.net All my published AU3-based apps and utilities 'Make it idiot-proof, and someone will make a better idiot' Link to comment Share on other sites More sharing options...
BrettF Posted February 28, 2008 Share Posted February 28, 2008 It seems one of the only ways to do it. An alternitave could be parsing an XML stylesheet, although both methods would work around the same speed and give you the same results. Do a search for Dynamic GUI's and you might be able to find something. Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! 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