Jump to content
Sign in to follow this  

Notice Panel

Recommended Posts


I never actually found a good way to use the splash functions. This is basically a simple notice panel example using the splash text function in a good way. I included all the variables I think you will ever need to keep the panel aligned where you want it although in the example I didn't take use of all of them.

Few notes that go with the example:

* The function _notice() can't be used by it self. You must set the $gui_title, $gui_notice_title, $gui_notice_text and define the $gui_pos_check variables.

* To display the panel call _notice() to close it call SplashOff()

* To change the title and or text of the panel set $gui_notice_title and or $gui_notice_text then call _notice()

#cs ----------------------------------------------------------------------------
    AutoIt Version: (beta)
    Author:      JC (Deltaforce229)
    Script Function:
    Notice Panel Example.
#ce ----------------------------------------------------------------------------
#include <GUIConstants.au3>
#Include <WindowsConstants.au3>
#include <WinAPI.au3>

Local $gui_title = "Notice Example";GUI TITLE
Local $gui_notice_title = "Notice Panel";STARTING NOTICE TITLE
Local $gui_notice_text = "";STARTING NOTICE TEXT

Local $gui_pos_check_left
Local $gui_pos_check_top
Local $gui_pos_check_right
Local $gui_pos_check_bottom
Local $gui_pos_check_width
Local $gui_pos_check_height

$gui = GUICreate($gui_title, 200, 300, -1, -1, $WS_SIZEBOX + $WS_MINIMIZEBOX)
$gui_button_1 = GUICtrlCreateButton("Button 1", 8, 10)
$gui_button_2 = GUICtrlCreateButton("Button 2", 8, 60)
$gui_button_3 = GUICtrlCreateButton("Button 3", 8, 110)


While 1
    $Msg = GUIGetMsg()
    $Pos = WinGetHandle($gui_title)
    $Pos = _WinAPI_GetWindowRect($Pos)
    If $gui_pos_check_left <> DllStructGetData($Pos, "Left") Or $gui_pos_check_top <> DllStructGetData($Pos, "Top") or $gui_pos_check_right <> DllStructGetData($Pos, "Right") Or $gui_pos_check_bottom <> DllStructGetData($Pos, "Bottom") Then
    If Not WinActive($gui_title) Then
        Case $Msg = $GUI_EVENT_CLOSE
        Case $Msg = $GUI_EVENT_MINIMIZE
        Case $Msg = $GUI_EVENT_RESTORE
        Case $Msg = $gui_button_1
            $gui_notice_title = "Notice Panel"
            $gui_notice_text = "Button 1 was pressed!"
        Case $Msg = $gui_button_2
            $gui_notice_title = "Notice Panel"
            $gui_notice_text = "Button 2 was pressed!"
        Case $Msg = $gui_button_3
            $gui_notice_title = "MY GOD MY JOB SUCKS!"
            $gui_notice_text = "Button 3 was pressed!" & @CRLF & "STOP PRESSING BUTTONS!!!!!"

Func _notice()
    $gui_pos = WinGetHandle($gui_title)
    $gui_pos = _WinAPI_GetWindowRect($gui_pos)
    $gui_pos_check_left = DllStructGetData($gui_pos, "Left")
    $gui_pos_check_top = DllStructGetData($gui_pos, "Top")
    $gui_pos_check_right = DllStructGetData($gui_pos, "Right")
    $gui_pos_check_bottom = DllStructGetData($gui_pos, "Bottom")
    $gui_pos_check_width = $gui_pos_check_right - $gui_pos_check_left
    $gui_pos_check_height = $gui_pos_check_bottom - $gui_pos_check_top - 25
    $gui_notice = SplashTextOn($gui_notice_title, $gui_notice_text, 250, $gui_pos_check_height, $gui_pos_check_right, $gui_pos_check_top)
EndFunc  ;==>_notice

[size="1"]Please stop confusing "how to" with "how do"[/size]

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  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.