Jump to content

Two little squares always on top waiting for the mouse


Recommended Posts

So, keeping my GUI on top isn't necessarily a good idea. It's sometimes in the way. Instead, I'd like to extend my GUI with two (or three) little squares "sitting" above my system clock, with a size of just about 5 to 10 pixels times 5 to 10 pixels. These buttons will replace other buttons which are not available because the GUI is minimized or in the background. I also want them to change color on events or blink for time to time.

You got the idea. Now the reason I am here is that I don't know how to start this. Whether it is images I should start playing with or something else, cause I don't want to end up after an hour of coding finding out that it can't be done and I have to rewrite everything.

So I'd like someone to point me in the right direction, right functions. I'm not asking to code for me, but that would be welcome too :) (I'd need to modify that as well anyhow)

Thanks !

Link to comment
Share on other sites

Hi,

Imho you would probably get a better response if you don't post..

cause I don't want to end up after an hour of coding finding out that it can't be done and I have to rewrite everything

Most cases that I've found is the code you start out with isn't the code you end up with, therefore you'll probly be rewriting your code more then once anyway to get the desired results.

Speaking a thought is 1 thing but actions get better results in most cases from what I've seen..

Maybe show that you've put some effort into doing some research on your own accord, eg:

I treid using code from a thread I found but the problem I'm having...

Some sort of Code effort posted by you..

Using the 2 things above would probably get a better response from readers of your thread.

With that said here's an example , not quite what you described, but sort of along those lines..

I've only tried it in Win XP..

(The minigui only shows correctly if your windows toolbar is at the bottom of your desktop)

CODE
#include <GuiConstants.au3>

Opt("WinTitleMatchMode", 4)

Global $button[14]

$MainGui = GUICreate ("test",395,200)
$x = 5
For $i = 1 To 6
    $button[$i] = GUICtrlCreateButton($i, $x, 10, 60, 30)
    GUICtrlSetTip($button[$i], 'Button ' & $i)
    $x = $x + 65
Next
GUISetState(@SW_SHOW, $MainGui)
$tp = WinGetPos("classname=Shell_TrayWnd")
$MiniGui = GUICreate ("test",138,17, @DesktopWidth - 138, @DesktopHeight - ($tp[3] + 17), $WS_POPUP, $WS_EX_TOPMOST, $MainGui)
$x = 1
For $i = 7 To 12
    $button[$i] = GUICtrlCreateButton($i - 6, $x, 1, 20, 15)
    GUICtrlSetFont($button[$i],6, 700)
    GUICtrlSetTip($button[$i], 'Button ' & $i -6)
    $x = $x + 21
Next
$button[13] = GUICtrlCreateLabel('^', $x, 1, 10, 15,$SS_CENTER)
GUICtrlSetFont($button[13],10)
GUISetState(@SW_HIDE, $MiniGui)

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
        Exit
        Case $msg = $GUI_EVENT_MINIMIZE
            GUISetState(@SW_SHOW, $MiniGui)
        Case $msg = $GUI_EVENT_RESTORE
            GUISetState(@SW_HIDE, $MiniGui)
            GUICtrlSetTip($button[13], 'Restore')
        Case $msg = $button[13]
            GUISetState(@SW_HIDE, $MiniGui)
            GUISetState(@SW_RESTORE, $MainGui)
    EndSelect
    For $v = 1 To 12
        Select
            Case $msg = $button[$v]
                $d = $v
                If $d >= 7 Then $d = $d - 6
                MsgBox(0,'', 'Button ' & $d & ' was clicked', 1)
        EndSelect
    Next    
WEnd
Hope it helps

Cheers

Edited by smashly
Link to comment
Share on other sites

First of all, thank you for your advice, I understand perfectly. I agree, but I really didn't want to waste my time, and all I actually wanted is a green light in a certain direction from someone who has the advantage of an overview upon the autoit scripting language... I don't want to waste anyone else's time either.

And thanks for the code as well, really, but it's not what I've been looking for. That really was a waste of time, and I'm sorry if I didn't make things clear in my first post. I meant something like floating images. I have created a complex GUI already, what you just showed me isn't what I want and is of no help to me. I meant "artificial buttons" used to trigger and announce events. Just an area of a few square pixels that interact. Nothing bigger than those 3 buttons that minimize, close or resize a window. But I have no idea what that "area" could be made of. GUICreate is something I don't want here. Using pictures maybe ? But how ? Or some layers ? (I couldn't find anything in the help file)

Could someone just point me in the right direction, cause that's all I ask here really. Here's are some simple questions. All I want is just a yes or no.

Can I approach this as with SplashImageOn and maybe somehow defining regions on it ? I guess I could bind this with MouseGetPos() somehow ?

Only one SplashImage/Text window is allowed at one time

So, how am I going to make it blink, by setting on and off different images ?

Edit: corrected spelling

Edited by birdofprey
Link to comment
Share on other sites

Here's are some simple questions. All I want is just a yes or no.

Yes

GUICreate is something I don't want here.

Even SplashImageOn actually displays an image on a Gui

Bottom line, there is no magic way to show a pic, label or any control without using GuiCreate.

Good luck

Cheers

Edited by smashly
Link to comment
Share on other sites

Look at my AutoDial project ( autodial_src.zip) in my signature.

I'm using GUICreate() with style/exstyle: BitOR($WS_POPUP,$WS_BORDER),BitOr($WS_EX_TOPMOST,$WS_EX_TOOLWINDOW)

I think this is what you need.

Yep, I think this is it. Thank you very much, both of you.

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