Vaeb Posted December 7, 2007 Share Posted December 7, 2007 (edited) hi! I would like to change a button (button-bad) to a better looking button (button-good). This is the script: $back = GUICtrlCreateButton(" ", "630", "10", "57","53",$BS_BITMAP) GUICtrlSetImage($back, @ScriptDir & "\System\back.bmp") the buttons: Edited December 12, 2007 by Vaeb I <3 it:http://www.autoitscript.com/forum/index.php?showtopic=69912http://www.autoitscript.com/forum/index.php?showtopic=69914http://www.autoitscript.com/forum/index.php?showtopic=69911 Link to comment Share on other sites More sharing options...
martin Posted December 7, 2007 Share Posted December 7, 2007 hi! I would like to change a button (button-bad) to a better looking button (button-good). This is the script: $back = GUICtrlCreateButton(" ", "630", "10", "57","53",$BS_BITMAP) GUICtrlSetImage($back, @ScriptDir & "\System\back.bmp") the buttons: Can you say what the problem is that you need help with? Is it connected with the fact that you want a button to have either the button_good or button_bad image but you are not setting it to have either? Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
Vaeb Posted December 12, 2007 Author Share Posted December 12, 2007 Okay: button_good and button_bad are screenshots of my gui. i made button_good by gimp. so how can i make it to look like button good, by programming? I hope you understand my weird reply. xD I <3 it:http://www.autoitscript.com/forum/index.php?showtopic=69912http://www.autoitscript.com/forum/index.php?showtopic=69914http://www.autoitscript.com/forum/index.php?showtopic=69911 Link to comment Share on other sites More sharing options...
ValeryVal Posted December 12, 2007 Share Posted December 12, 2007 You have to place your bad and good pictures into directory of this script AButton.au3: #include <GuiConstants.au3> Global $hWnd Global $Width = 400, $Height = $Width Global $Good = 1 $Style = $WS_THICKFRAME + $WS_POPUP $StyleEx = $WS_EX_OVERLAPPEDWINDOW $hWnd = GuiCreate("AJump (c) Valery Ivanov, 10 December 2007", $Width, $Height, (@DesktopWidth-$Width)/2, (@DesktopHeight-$Height)/2, $Style, $StyleEx) $Button = GUICtrlCreateButton(" ", 10, 10, 57, 53, $BS_BITMAP) GUICtrlSetImage($Button, @ScriptDir & "\button_good.bmp") GuiSetState() While 1 $Msg = GUIGetMsg(1) Select case $Msg[0] = $Button If $Good then GUICtrlSetImage($Button, @ScriptDir & "\button_bad.bmp") $Good = 0 else GUICtrlSetImage($Button, @ScriptDir & "\button_good.bmp") $Good = 1 endif case $Msg[0] = $GUI_EVENT_CLOSE exit endselect WEnd And enjoy it! The point of world view Link to comment Share on other sites More sharing options...
Vaeb Posted December 12, 2007 Author Share Posted December 12, 2007 no, this is not what i want. I want the button back.bmp be transparent as you can see on SCREENSHOT button-good. At the moment it looks like button-bad. here is the button "back.bmp":back.bmp I <3 it:http://www.autoitscript.com/forum/index.php?showtopic=69912http://www.autoitscript.com/forum/index.php?showtopic=69914http://www.autoitscript.com/forum/index.php?showtopic=69911 Link to comment Share on other sites More sharing options...
BrettF Posted December 12, 2007 Share Posted December 12, 2007 no, this is not what i want.I want the button back.bmp be transparent as you can see on SCREENSHOT button-good.At the moment it looks like button-bad.here is the button "back.bmp":Make it a gif?? 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...
Vaeb Posted December 12, 2007 Author Share Posted December 12, 2007 of course i tried that. i made a gif with transparent background. but when i add back.gif to the script instead of back.bmp, it just creates a button without picture. I <3 it:http://www.autoitscript.com/forum/index.php?showtopic=69912http://www.autoitscript.com/forum/index.php?showtopic=69914http://www.autoitscript.com/forum/index.php?showtopic=69911 Link to comment Share on other sites More sharing options...
ValeryVal Posted December 12, 2007 Share Posted December 12, 2007 Try use merlin.gif like pattern and this script: #include <GuiConstants.au3> Global $hWnd Global $Width = 400, $Height = $Width Global $Good = 1 $hWnd = GuiCreate('MyButton', $Width, $Height) $Button = GUICreate("AButton", 68, 71, 10, 10, $WS_POPUP, BitOr($WS_EX_LAYERED,$WS_EX_MDICHILD), $hWnd) GUICtrlCreatePic(@Systemdir & "\oobe\images\merlin.gif", 0, 0, 0, 0) GUISetState(@SW_SHOW, $Button) GUISetState(@SW_SHOW, $hWnd) While 1 $Msg = GUIGetMsg(1) If WinActive('AButton','') then MsgBox(0,'','Hi!') WinActivate('MyButton','') endif Select case $Msg[0] = $GUI_EVENT_CLOSE exit endselect WEnd The point of world view Link to comment Share on other sites More sharing options...
ValeryVal Posted December 12, 2007 Share Posted December 12, 2007 Moreover, you can very easy create many Merlins. Here they are 36 ones! Why not ? #include <GuiConstants.au3> Global $hWnd Global $Width = 440, $Height = $Width Global $Good = 1 $hWnd = GuiCreate('MyButton', $Width, $Height) For $i = 1 to 6 For $j = 1 to 6 $Button = GUICreate("AButton", 70, 70, 10 + 70*($i-1), 10 + 70*($j-1), $WS_POPUP, BitOr($WS_EX_LAYERED,$WS_EX_MDICHILD), $hWnd) GUICtrlCreatePic(@Systemdir & "\oobe\images\merlin.gif", 0, 0, 0, 0) GUISetState(@SW_SHOW, $Button) next next GUISetState(@SW_SHOW, $hWnd) While 1 $Msg = GUIGetMsg(1) If WinActive('AButton','') then MsgBox(0,'','Hi!') WinActivate('MyButton','') endif Select case $Msg[0] = $GUI_EVENT_CLOSE exit endselect WEnd The point of world view Link to comment Share on other sites More sharing options...
Vaeb Posted December 12, 2007 Author Share Posted December 12, 2007 (edited) Why the heck can't I see the Button with this Script?? #include <GuiConstants.au3> bla() Func bla() $Gui1 = GUICreate("Standort", "701", "641") $Button = GUICreate("back", "630", "10", "57", "53", $WS_POPUP, BitOr($WS_EX_LAYERED,$WS_EX_MDICHILD), $Gui1) GUICtrlCreatePic(@ScriptDir & "\System\back.gif",0,0,0,0) GUISetState(@SW_SHOW, $Button) GUISetState(@SW_SHOW, $Gui1) WinActivate('Standort','') While 1 $Msg = GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE Exit EndSwitch If WinActive('back','') Then ;GUISetState(@SW_HIDE, $Gui1) ;main() MsgBox(0,'','Hi!') WinActivate('Standort','') EndIf WEnd EndFunc Edited December 13, 2007 by Vaeb I <3 it:http://www.autoitscript.com/forum/index.php?showtopic=69912http://www.autoitscript.com/forum/index.php?showtopic=69914http://www.autoitscript.com/forum/index.php?showtopic=69911 Link to comment Share on other sites More sharing options...
Vaeb Posted December 13, 2007 Author Share Posted December 13, 2007 The button isnt Transparent. It just have a grey background. I want to see the picture behind the button! and when i move the parent window, the child window doesn't move too... I <3 it:http://www.autoitscript.com/forum/index.php?showtopic=69912http://www.autoitscript.com/forum/index.php?showtopic=69914http://www.autoitscript.com/forum/index.php?showtopic=69911 Link to comment Share on other sites More sharing options...
ValeryVal Posted December 13, 2007 Share Posted December 13, 2007 Are you waiting to my tips? You have to google - How to make transparent images? The point of world view Link to comment Share on other sites More sharing options...
Vaeb Posted December 13, 2007 Author Share Posted December 13, 2007 i know how to make transparent images. I have a button "back.gif". and its background is transparent. but the gui "$Button" (Standort) is not transparent. so i just see the background of the gui behind my transparent picture. do you understand now? I <3 it:http://www.autoitscript.com/forum/index.php?showtopic=69912http://www.autoitscript.com/forum/index.php?showtopic=69914http://www.autoitscript.com/forum/index.php?showtopic=69911 Link to comment Share on other sites More sharing options...
ValeryVal Posted December 13, 2007 Share Posted December 13, 2007 1. Place your back.gif into dir with this script. 2. Save it as MyTestImage.au3 3. Run MyTestImage.au3 from it's folder #include <GuiConstants.au3> Global $hWnd Global $Width = 400, $Height = $Width Global $Good = 1 $hWnd = GuiCreate('MyButton', $Width, $Height) $Button = GUICreate("AButton", 68, 71, 10, 10, $WS_POPUP, BitOr($WS_EX_LAYERED,$WS_EX_MDICHILD), $hWnd) GUICtrlCreatePic(@ScriptDir & "\back.gif", 0, 0, 0, 0) GUISetState(@SW_SHOW, $Button) GUISetState(@SW_SHOW, $hWnd) While 1 $Msg = GUIGetMsg(1) If WinActive('AButton','') then MsgBox(0,'','Hi!') WinActivate('MyButton','') endif Select case $Msg[0] = $GUI_EVENT_CLOSE exit endselect WEnd 4. Report about your result to be clear. Don't use button control. It isn't invalid for your aim! The point of world view Link to comment Share on other sites More sharing options...
Vaeb Posted December 13, 2007 Author Share Posted December 13, 2007 yes I tryed your script. It works. But the other GUI "$hWnd" needs a background picture. when i add the background picture to your script, the script looks like that: #include <GuiConstants.au3> Global $hWnd Global $Width = 400, $Height = $Width Global $Good = 1 $hWnd = GuiCreate('MyButton', $Width, $Height) $pic111 = GUICtrlCreatePic(@ScriptDir & "\System\Imagemap1.bmp", "5", "5", "691", "631", $WS_CLIPSIBLINGS) $Button = GUICreate("AButton", 68, 71, 10, 10, $WS_POPUP, BitOr($WS_EX_LAYERED,$WS_EX_MDICHILD), $hWnd) GUICtrlCreatePic(@ScriptDir & "\System\back.gif", 0, 0, 0, 0) GUISetState(@SW_SHOW, $Button) GUISetState(@SW_SHOW, $hWnd) While 1 $Msg = GUIGetMsg(1) If WinActive('AButton','') then MsgBox(0,'','Hi!') WinActivate('MyButton','') endif Select case $Msg[0] = $GUI_EVENT_CLOSE exit endselect WEnd but there is a f***ing grey box around "back.gif"! I <3 it:http://www.autoitscript.com/forum/index.php?showtopic=69912http://www.autoitscript.com/forum/index.php?showtopic=69914http://www.autoitscript.com/forum/index.php?showtopic=69911 Link to comment Share on other sites More sharing options...
martin Posted December 13, 2007 Share Posted December 13, 2007 yes I tryed your script. It works. But the other GUI "$hWnd" needs a background picture. when i add the background picture to your script, the script looks like that: #include <GuiConstants.au3> Global $hWnd Global $Width = 400, $Height = $Width Global $Good = 1 $hWnd = GuiCreate('MyButton', $Width, $Height) $pic111 = GUICtrlCreatePic(@ScriptDir & "\System\Imagemap1.bmp", "5", "5", "691", "631", $WS_CLIPSIBLINGS) $Button = GUICreate("AButton", 68, 71, 10, 10, $WS_POPUP, BitOr($WS_EX_LAYERED,$WS_EX_MDICHILD), $hWnd) GUICtrlCreatePic(@ScriptDir & "\System\back.gif", 0, 0, 0, 0) GUISetState(@SW_SHOW, $Button) GUISetState(@SW_SHOW, $hWnd) While 1 $Msg = GUIGetMsg(1) If WinActive('AButton','') then MsgBox(0,'','Hi!') WinActivate('MyButton','') endif Select case $Msg[0] = $GUI_EVENT_CLOSE exit endselect WEnd I'm not too good in this area, but I'll have look if you can post a script which I can run and see the problem. Please supply the images you are using as well. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
Vaeb Posted December 14, 2007 Author Share Posted December 14, 2007 (edited) i know the reason now. it didn't work with .gif, only with .bmp - lol Edited December 14, 2007 by Vaeb I <3 it:http://www.autoitscript.com/forum/index.php?showtopic=69912http://www.autoitscript.com/forum/index.php?showtopic=69914http://www.autoitscript.com/forum/index.php?showtopic=69911 Link to comment Share on other sites More sharing options...
Vaeb Posted December 14, 2007 Author Share Posted December 14, 2007 (edited) I've got a new problem.When i open another window and close it, is the window 'back' active.this means the function runs when it shouldn't.EDIT:@ ValeryRun your script and open another window.you will see that the msgbox "Hi!" appears without clicking on the button.Do any1 know how to fix this?Or any other ways to make a button like that? Edited December 14, 2007 by Vaeb I <3 it:http://www.autoitscript.com/forum/index.php?showtopic=69912http://www.autoitscript.com/forum/index.php?showtopic=69914http://www.autoitscript.com/forum/index.php?showtopic=69911 Link to comment Share on other sites More sharing options...
ValeryVal Posted December 14, 2007 Share Posted December 14, 2007 My script works fine for me. Don't worry about Merlin. He is good boy. The point of world view Link to comment Share on other sites More sharing options...
Vaeb Posted December 14, 2007 Author Share Posted December 14, 2007 (edited) I can't belive that it works at your computer.¨ Please test it: 1. start your merlin script 2. open & minimize a window (Internet Explorer, SciTe or anything else) 3. look if the msgbox appeared. 4. Please tell me if your merlin really works. TEST IT pls This script really opens a msgbox when you minimize another window. Trust me, i testet it on other computers. Edited December 14, 2007 by Vaeb I <3 it:http://www.autoitscript.com/forum/index.php?showtopic=69912http://www.autoitscript.com/forum/index.php?showtopic=69914http://www.autoitscript.com/forum/index.php?showtopic=69911 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