Jump to content

Hidden button wich is clickable


Recommended Posts

Hi,

I am strugling to do the following.

I have a program wich creates an page where you can interect with your lights in your house.

This application creates a page where you can click buttons to turn on or off several objects. The only thing this application can't do is start an windows application.

What i would like to accomplish is to create a hidden / stealth / invisible button wich i can overlay a picture on the monitor. Wich is in this case a touchscreen.

So if they click on the name, my program kicks in and execute internet explorer with a default start page.

My question is, is their any way to create a hidden clickable box / image or something, so the user can't see it as a autoit button, but if they click autoit extends the use and opens internet explorer?

Link to comment
Share on other sites

AnyGUI.

http://www.autoitscript.com/forum/index.php?showtopic=9517&hl=anygui&st=0

Edited by P5ych0Gigabyte
HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code.
Link to comment
Share on other sites

Maybe an other way. Is it possible to create a button with a picture wich hasn't any borders. So only the picture is visable?

It needs to look exactly like this one:

Posted Image

I could delete the button in the program and if AutoIT can make a button wich no borders and just the image. I could put them on that position.

Link to comment
Share on other sites

Hi,

Have you tried WinSetTrans? It sets the transparency of a window... Windows 2000/XP or later only

If i set it to 100, will the area still be clickable?

You can make a label with a transparent background. It registers click events.

If i want to make a label i still need an GUI don't i?

I have the following simple code:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GUIConstants.au3>

    GUICreate("My GUI", 170, 44, 3, 722,BitOR($WS_POPUP,$WS_DLGFRAME))
    ;GUICtrlSetState(-1, $GUI_DISABLE)
    GUICtrlCreatePic("G:\Gira\Favorieten.jpg", 0, 0, 170, 44)
    GUISetBkColor(0x000000)
    GUISetState(@SW_SHOW)

    While 1
        $msg = GUIGetMsg()

        If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    WEnd
    GUIDelete()

But i still got some stupid border around my picture.

Link to comment
Share on other sites

$WS_DLGFRAME 0x00400000 Creates a window that has a border of a style typically used with dialog boxes.

And you're frustrated about the fact that your window has a border?

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GUIConstants.au3>

GUICreate("My GUI", 170, 44, 3, 722, $WS_POPUP)
;GUICtrlSetState(-1, $GUI_DISABLE)
GUICtrlCreatePic("G:\Gira\Favorieten.jpg", 0, 0, 170, 44)
GUISetBkColor(0x000000)
GUISetState(@SW_SHOW)

While 1
    $msg = GUIGetMsg()

    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd
GUIDelete()
Edited by Manadar
Link to comment
Share on other sites

$WS_DLGFRAME 0x00400000 Creates a window that has a border of a style typically used with dialog boxes.

And you're frustrated about the fact that your window has a border?

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GUIConstants.au3>

GUICreate("My GUI", 170, 44, 3, 722, $WS_POPUP)
;GUICtrlSetState(-1, $GUI_DISABLE)
GUICtrlCreatePic("G:\Gira\Favorieten.jpg", 0, 0, 170, 44)
GUISetBkColor(0x000000)
GUISetState(@SW_SHOW)

While 1
    $msg = GUIGetMsg()

    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd
GUIDelete()

:) Sorry, feeling a bit stupid here. How easy can it be. Thank you so much for taking the time to help me.

You just made a very happy person.

Link to comment
Share on other sites

Yes, overlay it with a transparent label. The label registers the click event. I said this a while ago. : )

Ok but i looked in the help file because it has been a while for me i have used AutoIt, but how can you make a label clickable?

You need a button for that as far as i know. :)

Link to comment
Share on other sites

A label is clickable by default because of the forced style $SS_NOTIFY.

Why does this not work?

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GUIConstants.au3>

GUICreate("My GUI", 170, 44, 3, 722, $WS_POPUP)
;GUICtrlSetState(-1, $GUI_DISABLE)
GUICtrlCreatePic("G:\Gira\Favorieten.jpg", 0, 0, 170, 44)
$Label = GUICtrlCreateLabel("Line 1 Cell 1", 10, 30)

GUISetState(@SW_SHOW)


While 1
   $msg = GUIGetMsg()
   Select
    Case $msg = $GUI_EVENT_CLOSE
        GUIDelete()
           Exit
       Case $msg = $Label
        GUIDelete()
            Exit
        ExitLoop
   EndSelect
Wend

Sorry if i messed everything up. I am focussed to long about this stupid thing.

Link to comment
Share on other sites

From the help file GUICtrlCreatePic:

If a picture is set as a background picture, as the other controls will overlap, it's important to disable the pic control and create it after the others controls: GuiCtrlSetState(-1,$GUI_DISABLE).

I also tried that, but still the label sits there and nothing happened.

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GUIConstants.au3>
#include <GuiButton.au3>

GUICreate("My GUI", 170, 44, 3, 722, $WS_POPUP)

GUICtrlCreatePic("G:\Gira\Favorieten.jpg", 0, 0, 170, 44)
GUICtrlSetState(-1, $GUI_DISABLE)
$Label = GUICtrlCreateLabel("Line 1 Cell 1", 10, 30)

;   $label = GUICtrlCreateButton("Button1", 0, 0, 170, 44, $BS_BITMAP)
;   _GUICtrlButton_SetImage($label, "G:\Gira\Favorieten.ico")
;   _GUICtrlButton_SetFocus($label, False)


GUISetState(@SW_SHOW)


While 1
   $msg = GUIGetMsg()
   Select
    Case $msg = $GUI_EVENT_CLOSE
        GUIDelete()
           Exit
;       Case $msg = $Label
;       GUIDelete()
;           Exit
        ExitLoop
   EndSelect
Wend

As you can see i already have tried to create a button with an image. Just made an .ico file from the image, but then the button will have a dotted line as in focus. Found a topic where you can create a workaround. But i am just a noob at this and still learning. I get confused by looking at the code only if its pages long.

Still no luck to create it so i can start a program

Link to comment
Share on other sites

Overlay the image with a transparent label.

This means that:

1. The label size and position must be set to the area you want to click.

2. The label background must be transparent.

If a picture is set as a background picture, as the other controls will overlap, it's important to disable the pic control and create it after the others controls: GuiCtrlSetState(-1,$GUI_DISABLE).

This means that:

3. You must disable the picture control

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GUIConstants.au3>

GUICreate("My GUI", 170, 44, 3, 722, $WS_POPUP)

GUICtrlCreatePic("reeeeeeh.gif", 0, 0, 170, 44)
GUICtrlSetState(-1, $GUI_DISABLE) ; Requirement 3

$Label = GUICtrlCreateLabel("", 0, 0, 170, 44) ; Requirement 1
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) ; Requirement 2

GUISetState(@SW_SHOW)

While 1
   $msg = GUIGetMsg()
   Select
    Case $msg = $GUI_EVENT_CLOSE
        GUIDelete()
           Exit
       Case $msg = $Label
        GUIDelete()
            Exit
        ExitLoop
   EndSelect
Wend
Link to comment
Share on other sites

Overlay the image with a transparent label.

This means that:

1. The label size and position must be set to the area you want to click.

2. The label background must be transparent.

If a picture is set as a background picture, as the other controls will overlap, it's important to disable the pic control and create it after the others controls: GuiCtrlSetState(-1,$GUI_DISABLE).

This means that:

3. You must disable the picture control

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GUIConstants.au3>

GUICreate("My GUI", 170, 44, 3, 722, $WS_POPUP)

GUICtrlCreatePic("reeeeeeh.gif", 0, 0, 170, 44)
GUICtrlSetState(-1, $GUI_DISABLE) ; Requirement 3

$Label = GUICtrlCreateLabel("", 0, 0, 170, 44) ; Requirement 1
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) ; Requirement 2

GUISetState(@SW_SHOW)

While 1
   $msg = GUIGetMsg()
   Select
    Case $msg = $GUI_EVENT_CLOSE
        GUIDelete()
           Exit
       Case $msg = $Label
        GUIDelete()
            Exit
        ExitLoop
   EndSelect
Wend

Thanks for your explanation, still not understanding it quite right, but i will compare it with the help files and hopefully i will see the light and understand this right.

Again many thanks for your patience and time.

Link to comment
Share on other sites

Ok i have made some progress, but still need some help.

This is my code:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GUIConstants.au3>

GUICreate("Favorieten", 170, 44, 3, 722, $WS_POPUP)

GUICtrlCreatePic("G:\Gira\Favorieten.jpg", 0, 0, 170, 44)
GUICtrlSetState(-1, $GUI_DISABLE) ; Requirement 3

$Label = GUICtrlCreateLabel("", 0, 0, 170, 44) ; Requirement 1
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) ; Requirement 2

GUISetState(@SW_SHOW)

While 1
   $msg = GUIGetMsg()
   Select
    Case $msg = $GUI_EVENT_CLOSE
        Exit
        ;Do nothing
       Case $msg = $Label
        Run("C:\Program Files\Internet Explorer\iexplore.exe")
        Run("C:\Windows\system32\osk.exe")
        WinSetState("Favorieten", "", @SW_MINIMIZE)
        

    EndSelect
    
    If ProcessExists("iexplore.exe") Then
        ;do Nothing
    Else
        If ProcessExists("osk.exe") Then
            ProcessClose("osk.exe")
        EndIf
        WinActivate("Favorieten") 
    EndIf
Wend

On the bottom i am using IF and END statement, i also tried the WEnd statement.

But what i want is that this button is always on top. Because i have WinActivate sitting in the While loop this will happen, but i need the following.

The program where this button should be on top is a full screen application.

This application needs to be in full screen and can be managed by a touch screen. When my button goes active it pops up and as you know the taskbar will become visiable.

Is there someway to put this button on top of an full screen application, when pressed it minimize, when iexplore is closed it activates the full screen application, but it shouldn't put the taskbar in front.

Any ideas?

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...