BruceCopperField Posted June 8, 2008 Posted June 8, 2008 (edited) Are there any ways to create a transparent /invisible button on top of a background image and is responding to user click? I tried GUICtrlSetState(-1, BitOr($GUI_HIDE,$GUI_ENABLE)) but the button seems must be hidden and disabled at the same time. Edited June 8, 2008 by BruceCopperField
Andreik Posted June 8, 2008 Posted June 8, 2008 (edited) Are there any ways to create a transparent /invisible button on top of a background image and is responding to user click? I tried GUICtrlSetState(-1, BitOr($GUI_HIDE,$GUI_ENABLE)) but the button seems must be hidden and disabled at the same time. Use ControlHide ( "title", "text", controlID ). Example: $GUI = GUICreate("TEST",200,200) $BUTTON = GUICtrlCreateButton("OK",50,50,100,100) GUISetState(@SW_SHOW,$GUI) ControlHide ( "TEST", "", $BUTTON ) HotKeySet("1","_Show") HotKeySet("2","_Hide") While 1 $MSG = GUIGetMsg() If $MSG = -3 Then Exit WEnd Func _Show() ControlShow ( "TEST", "", $BUTTON ) EndFunc Func _Hide() ControlHide ( "TEST", "", $BUTTON ) EndFunc Edited June 8, 2008 by Andreik
BruceCopperField Posted June 8, 2008 Author Posted June 8, 2008 But it seems that once hidden(even with ControlHide()), the button no longer responds to a click. I just want to have a transparent button effect which means the button is not visible but can still capture a click to the area which the button supposed to occupy.
ChrisL Posted June 8, 2008 Posted June 8, 2008 Have a look at this what I did I've just posted it in example scripts. Create a button with my script and set the transparency level so you can't see it. See if that works for you.When you create these transparent controls make sure you have created the rest of your GUI firsthttp://www.autoitscript.com/forum/index.php?showtopic=73121 [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire
martin Posted June 8, 2008 Posted June 8, 2008 Are there any ways to create a transparent /invisible button on top of a background image and is responding to user click? I tried GUICtrlSetState(-1, BitOr($GUI_HIDE,$GUI_ENABLE)) but the button seems must be hidden and disabled at the same time.The easiest way is to create a label with no text. Then it's not 'visible'. You can make it the size you want and it will generate a message when it's clicked just like a button. 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.
Lee Bussy Posted June 16, 2008 Posted June 16, 2008 I hope the OP does not mind a hijack ... I'm having the same issue: The easiest way is to create a label with no text. Then it's not 'visible'. You can make it the size you want and it will generate a message when it's clicked just like a button.Tried this (with no text) and it still creates a white box: $btnCast = GUICtrlCreateButton("", 592, 710, 22, 22) Tried this which looked promising: $btnCast = GUICtrlCreateButton("", 592, 710, 22, 22, $WS_EX_TRANSPARENT) ... but it still creates a white box on top of my main window. Also tried creating a button that is a copy of the underlyying image but I still get a white border: $btnCast = GUICtrlCreateButton("", 592, 710, 22, 22, BitOR($BS_BITMAP, $BS_FLAT)) GUICtrlSetImage(-1, ".\btnCast.bmp", 0) Basically I want there to be a button there with no visible border, or completely transparent - either way will work. Any ideas?
ProgAndy Posted June 17, 2008 Posted June 17, 2008 (edited) You have to use a LABEL: $btnCast = GUICtrlCreateLabel("", 592, 710, 22, 22) GUICtrlSetBKColor(-1,$GUI_BKCOLOR_TRANSPARENT) Edited June 17, 2008 by ProgAndy *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes
Kip Posted June 17, 2008 Posted June 17, 2008 Or a pic: $hInvisibleButClickable = Guictrlcreatepic("",10,10,120,120) MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API.
Lee Bussy Posted June 17, 2008 Posted June 17, 2008 Thanks for both tips .... I'll try them as soon as I fix these other issues I'm having with my system.Isn't it always the case that before you can do one thing something else has to be done and then before you can do that, something else ....
Lee Bussy Posted June 18, 2008 Posted June 18, 2008 Okay I got it to work, thanks to everyone for the help. Having some different issues now but I'll plug along and make a different post if I can't figure it out.
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