Jump to content

Gui selected


Recommended Posts

Hi to all, i've to do a simple question, but i don't know the function to do this...

For example i would like to know if "my programm gui is selected", there are a function to do that (sure yes, autoit powa :x ?...and if it was "on top" it give a simple msgbox.

P.S. How i can make my gui always on top and switch it to "always on top on" and "always on top off" with a button?

Thank's a lot :P

Hi to all :shifty:

Edited by StungStang
Link to comment
Share on other sites

  • Moderators

StungStang,

Dog eaten your Help file? :P

i would like to know if "my programm gui is selected"

Use WinGetState and check if the GUI is active.

How i can make my gui always on top?

- 1. Create the GUI with $WS_EX_TOPMOST extended style.

- 2. Use WinSetOnTop.

The online Help file is here, by the way. :x

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

I see a lot on help file, but if you don't know how function is named, is very hard to find it =P

How i can always force my gui to always on top, if i've press te button "always on top on" ? With WinSetOnTop() it dont force all time my gui, but with $WS_EX_TOPMOST i can't put my gui in "always on top off" :x

Hi thank's for help

Link to comment
Share on other sites

  • Moderators

StungStang,

but with $WS_EX_TOPMOST i can't put my gui in "always on top off

Yes you can. Just remove the style when you no longer need it. :P

The Setting Styles tutorial in the Wiki tells you how to do this. :x

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

I've write this code :

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

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 357, 189, 304, 240)
$MenuItem1 = GUICtrlCreateMenu("File")
$MenuItem3 = GUICtrlCreateMenuItem("Always on top", $MenuItem1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $MenuItem3
            If BitAND (GUICtrlRead ($MenuItem3),$GUI_UNCHECKED) Then
            GUICtrlSetStyle($Form1,$WS_EX_TOPMOST) ;Dont work
            GUICtrlSetState ($MenuItem3,$GUI_CHECKED)
        ElseIf BitAND (GUICtrlRead ($MenuItem3),$GUI_CHECKED) Then
            GUICtrlSetState ($MenuItem3,$GUI_UNCHECKED)
            ;How to set normal gui?
            EndIf

    EndSwitch
WEnd

But unfortunatly dont work :x...any fix ?

Link to comment
Share on other sites

GUICtrlSetStyle is for Controls and not for a GUI.

Here is a Example with WinSetOnTop:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 357, 189, 304, 240)
$MenuItem1 = GUICtrlCreateMenu("File")
$MenuItem3 = GUICtrlCreateMenuItem("Always on top", $MenuItem1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $MenuItem3
            Local $Attrib = BitAND(GUICtrlRead($MenuItem3), $GUI_CHECKED)
            Switch $Attrib
                Case 0
                    GUICtrlSetState($MenuItem3, $GUI_CHECKED)
                Case 1
                    GUICtrlSetState($MenuItem3, $GUI_UNCHECKED)
            EndSwitch
            $Attrib = Not $Attrib
            WinSetOnTop($Form1, "", $Attrib)
    EndSwitch
WEnd
Edited by Raupi
Link to comment
Share on other sites

Ok this is my solution, thanks for your help :x

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

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 357, 189, 304, 240)
$MenuItem1 = GUICtrlCreateMenu("File")
$MenuItem3 = GUICtrlCreateMenuItem("Always on top", $MenuItem1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $MenuItem3
            If BitAND (GUICtrlRead ($MenuItem3),$GUI_UNCHECKED) Then
            GUICtrlSetState($MenuItem3,$GUI_CHECKED) 
            WinSetOnTop($Form1, "", 1)
        ElseIf BitAND (GUICtrlRead ($MenuItem3),$GUI_CHECKED) Then
            GUICtrlSetState ($MenuItem3,$GUI_UNCHECKED)
            WinSetOnTop($Form1, "", 0)
        EndIf


    EndSwitch
WEnd

Hi :P

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