Jump to content
Sign in to follow this  
BruceCopperField

Transparent Button Possible?

Recommended Posts

BruceCopperField

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 by BruceCopperField

Share this post


Link to post
Share on other sites
Andreik

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 by Andreik

When the words fail... music speaks

Share this post


Link to post
Share on other sites
BruceCopperField

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.

Share this post


Link to post
Share on other sites
ChrisL

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 first

http://www.autoitscript.com/forum/index.php?showtopic=73121

Share this post


Link to post
Share on other sites
martin

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.

Share this post


Link to post
Share on other sites
Lee Bussy

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?

Share this post


Link to post
Share on other sites
Lee Bussy

Bump?

Share this post


Link to post
Share on other sites
ProgAndy

You have to use a LABEL:

$btnCast = GUICtrlCreateLabel("", 592, 710, 22, 22)

GUICtrlSetBKColor(-1,$GUI_BKCOLOR_TRANSPARENT)

Edited 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

Share this post


Link to post
Share on other sites
Lee Bussy

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 ....

Share this post


Link to post
Share on other sites
Lee Bussy

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.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×