Sign in to follow this  
Followers 0
shanet

GUI Extension?

9 posts in this topic

Hey everyone,

I have done a little sketch to explain what I want to achieve as it is the easiest way to get it across.

Basically, when you click a button, the GUI 'extends', or something pops out of the bottom of it - NOT ANOTHER GUI!

Posted Image

GUICreate("Example Script", 200, 100)
GUICtrlCreateButton("Close", 75, 40, 60)
GUISetState()

While GUIGetMsg() <> -3
WEnd

[font="Comic Sans MS"]My code does not have bugs! It just develops random features.[/font]My Projects[list][*]Live Streaming (Not my project, but my edited version)[right]AutoIt Wrappers![/right][/list]Pure randomness[list][*]Small Minds.......................................................................................................[size="1"]Simple progress bar that changes direction at either sides.[/size][*]ChristmasIt AutoIt Christmas Theme..........................................................[size="1"]I WAS BOOOORED![/size][*]DriveToy..............................................................................................................[size="1"]Simple joke script. Trick your friends into thinking their computer drive is haywire![/size][/list]In Development[list][*]Your Background Task Organiser[*]AInstall Second Generation[/list]BEFORE POSTING ON THE FORUMS, TRY THIS:
%programfiles%/AutoIt3/autoit3.chm

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

It has to be another GUI. This is Version I put together in 10mins, its only a very basic Example. I would recommend AdlibUnRegister() and also Melba23's to get an idea of how to put focus back to the _Main() GUI. $WS_EX_MDICHILD is important because it allows you to move the _Main() GUI around with the Popup following.

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

_Main()

Func _Main()
    Local $Msg

    Local $GUI = GUICreate("Popup Example", 300, 300)
    GUICtrlCreateLabel("This Is A Sample Label!", 5, 10, 115, 20)
    Local $Button_1 = GUICtrlCreateButton("Popup_1", 125, 5, 65, 20)
    GUISetState(@SW_SHOW, $GUI)

    While 1
        $Msg = GUIGetMsg()
        If $Msg = -3 Then ExitLoop
        If $Msg = $Button_1 Then
            _Popup($GUI)
        EndIf
    WEnd
    GUIDelete()
EndFunc   ;==>_Main

Func _Popup($pHandle, $pTitle = "",  $pHeight = 50)
    Local $Msg
    Local $pSize = WinGetClientSize($pHandle)
    Local $pGUI = GUICreate($pTitle, $pSize[0], $pHeight,0 ,$pSize[1] + 6, $WS_POPUPWINDOW, $WS_EX_MDICHILD, $pHandle)
    Local $pLabel = GUICtrlCreateLabel("Close Me [X]!", 5, 10, 115, 20)
    DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $pGUI, "int", 250, "long", 0x00040004)
    GUISetState(@SW_SHOW, $pGUI)

    While 1
        $Msg = GUIGetMsg()
        If $Msg = $pLabel Then ExitLoop
    WEnd
    DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $pGUI, "int", 250, "long", 0x00050008)
    GUIDelete($pGUI)
    Return 1
EndFunc
Edited by guinness

_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

shanet,

You are in luck! :x I had just finished a small UDF to do exactly this and you can be the first to try it. :P

The UDF:

#include-once

; #INDEX# ============================================================================================================
; Title .........: Popper
; AutoIt Version : 3.3.2.0
; Language ......: English
; Description ...: Show and hides pop-out messages from behind a GUI in user defined colours and fonts
; Author(s) .....: Melba23.
; ====================================================================================================================

;#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6

; #INCLUDES# =========================================================================================================
#include <StringSize.au3>

; #GLOBAL VARIABLES# =================================================================================================
Global $iDef_Popper_Font_Size   = _Popper_GetDefFont(0)
Global $sDef_Popper_Font_Name   = _Popper_GetDefFont(1)

Global $hPopper_Handle    = 0
Global $iPopper_Move_Out  = 0
Global $iPopper_Style     = 1 ; $SS_CENTER
Global $iPopper_Fit       = 80 ; Max size
Global $aRet = DllCall("User32.dll", "int", "GetSysColor", "int", 8) ; $COLOR_WINDOWTEXT = 8
Global $iPopper_Col       = $aRet[0]
$aRet = DllCall("User32.dll", "int", "GetSysColor", "int", 5) ; $COLOR_WINDOW = 5
Global $iPopper_BkCol     = $aRet[0]
Global $iPopper_Font_Size = $iDef_Popper_Font_Size
Global $sPopper_Font_Name = $sDef_Popper_Font_Name

; #CURRENT# ==========================================================================================================
; _Popper_Set:  Sets text justification and optionally style, colours and font for _Popper_Show function calls
; _Popper_Show: Shows a pop-out message from behind a GUI
; _Popper_Hide: Hides a pop-out message from behind a GUI
; ====================================================================================================================

; #INTERNAL_USE_ONLY#=================================================================================================
; _Popper_GetDefFont:    Determine system default MsgBox font and size
; ====================================================================================================================

; #FUNCTION# =========================================================================================================
; Name...........: _Popper_Set
; Description ...: Sets text justification and optionally colours and font, for _Popper_Show function calls
; Syntax.........: _Popper_Set($vJust, [$iFit, [$iMsg_BkCol, [$iMsg_Col, [$sFont_Size, [$iFont_Name]]]]])
; Parameters ....: $vJust     - 0 = Left justified, 1 = Centred (Default), 2 = Right justified
;                                Can use $SS_LEFT, $SS_CENTER, $SS_RIGHT
;                       >>>>>    Setting this parameter to' Default' will reset ALL parameters to default values     <<<<<
;                       >>>>>    All optional parameters default to system MsgBox default values                     <<<<<
;                  $iFit       - [Optional] Percentage of GUI size to use for Popper (Default = 80%, -1 = Fit to size)
;                  $iMsg_BkCol - [Optional] The colour for the Popper background
;                  $iMsg_Col   - [Optional] The colour for the Popper text
;                                Omitting a colour parameter or setting it to -1 leaves it unchanged
;                                Setting a colour parameter to Default resets the system colour
;                  $iFont_Size - [Optional] The font size in points to use for the Popper
;                  $sFont_Name - [Optional] The font to use for the Popper
;                       >>>>>    Omitting a font parameter, setting size to -1 or name to "" leaves it unchanged     <<<<<
;                       >>>>>    Setting a font parameter to Default resets the system message box font or size      <<<<<
; Requirement(s).: v3.3.2.0 or higher
; Return values .: Success - Returns 1
;                  Failure - Returns 0 and sets @error to 1 with @extended set to parameter index number
; Author ........: Melba23
; Example........; Yes
;=====================================================================================================================

Func _Popper_Set($vJust, $iFit = 80, $iMsg_BkCol = -1, $iMsg_Col = -1, $iFont_Size = -1, $sFont_Name = "")

    ; Set parameters
    Switch $vJust
        Case Default
            $iPopper_Style     = 1; $SS_CENTER
            $iPopper_Fit       = 80
            $aRet = DllCall("User32.dll", "int", "GetSysColor", "int", 8) ; $COLOR_WINDOWTEXT = 8
            $iPopper_Col       = $aRet[0]
            $aRet = DllCall("User32.dll", "int", "GetSysColor", "int", 5) ; $COLOR_WINDOW = 5
            $iPopper_BkCol     = $aRet[0]
            $sPopper_Font_Name = $sDef_Popper_Font_Name
            $iPopper_Font_Size = $iDef_Popper_Font_Size
            Return
        Case 0, 1, 2
            $iPopper_Style = $vJust
        Case -1
            ; Do nothing
        Case Else
            Return SetError(1, 1, 0)
    EndSwitch

    Switch $iFit
        Case Default
            $iPopper_Fit = 80
        Case -1 To 100
            $iPopper_Fit = $iFit
        Case Else
            Return SetError(1, 2, 0)
    EndSwitch

    Switch $iMsg_BkCol
        Case Default
            $aRet = DllCall("User32.dll", "int", "GetSysColor", "int", 5) ; $COLOR_WINDOW = 5
            $iPopper_BkCol  = $aRet[0]
        Case 0 To 0xFFFFFF
            $iPopper_BkCol = Int($iMsg_BkCol)
        Case -1
            ; Do nothing
        Case Else
            Return SetError(1, 3, 0)
    EndSwitch

    Switch $iMsg_Col
        Case Default
            $aRet = DllCall("User32.dll", "int", "GetSysColor", "int", 8) ; $COLOR_WINDOWTEXT = 8
            $iPopper_Col  = $aRet[0]
        Case 0 To 0xFFFFFF
            $iPopper_Col = Int($iMsg_Col)
        Case -1
            ; Do nothing
        Case Else
            Return SetError(1, 4, 0)
    EndSwitch

    Switch $iFont_Size
        Case Default
            $iPopper_Font_Size = $iDef_Popper_Font_Size
        Case 8 To 72
            $iPopper_Font_Size = Int($iFont_Size)
        Case -1
            ; Do nothing
        Case Else
            Return SetError(1, 5, 0)
    EndSwitch

    Switch $sFont_Name
        Case Default
            $sPopper_Font_Name = $sDef_Popper_Font_Name
        Case ""
            ; Do nothing
        Case Else
            If IsString($sFont_Name) Then
                $sPopper_Font_Name = $sFont_Name
            Else
                Return SetError(1, 6, 0)
            EndIf
    EndSwitch

    Return 1

EndFunc ; => _Popper_Set

; #FUNCTION# =========================================================================================================
; Name...........: _Popper_Show
; Description ...: Shows a pop-out message from behind a GUI
; Syntax.........: _Popper_Show($hWnd, $sMessage, [$iOrient, [$iDelay]])
; Parameters ....: $hWnd     - GUI to use
;                  $sMessage - Text to display in Popper body
;                  $iOrient  - position on GUI (0 = Top (default), 1 = Right, 2 = Bottom, 4 = Left)
;                  $iDelay   - The delay in seconds before the Popper retracts (Default = Popper stays visible)
; Requirement(s).: v3.3.1.5 or higher
; Return values .: Success: Returns 2-element array: [Popper width, Popper height]
;                  Failure: Returns -1 and sets @error as follows:
;                           1 = GUI not found or invalid handle
;                           2 = StringSize error
;                           3 = Text too large for max Popper size
;                           4 = Popper creation fail
; Author ........: Melba23
; Notes .........; Any visible Popper is retracted by a subsequent _Popper_Hide or _Popper_Show
; Example........; Yes
;=====================================================================================================================

Func _Popper_Show($hWnd, $sMessage, $iOrient = 0, $iDelay = 0, $fWait = True)

    Local $aPopper_Move_In, $iPopper_X, $iPopper_Y, $iPopper_W, $iPopper_H

    ; Check valid and visible GUI
    If Not(IsHWnd($hWnd)) Or Not(BitAnd(WinGetState($hWnd), 2)) Then Return SetError(1, 0, -1)

    ; Store current GUI mode and set Message mode
    Local $nOldOpt = Opt('GUIOnEventMode', 0)

    ; Retract any Popper already in place
    If $hPopper_Handle <> 0 Then _Popper_Hide()

    ; Get GUI pos and size
    Local $aGUI_Pos = WinGetPos($hWnd)

    ; Get max Popper size required
    Switch $iPopper_Fit
        Case 0 To 80
            $iPopper_W = Int($aGUI_Pos[2] * $iPopper_Fit / 100)
            $iPopper_H = Int($aGUI_Pos[3] * $iPopper_Fit / 100)
        Case -1
            $iPopper_W = Int($aGUI_Pos[2] * .8)
            $iPopper_H = Int($aGUI_Pos[3] * .8)
    EndSwitch

    ; Get message label size
    Local $aLabel_Size = _StringSize($sMessage, $iPopper_Font_Size, Default, Default, $sPopper_Font_Name, $iPopper_W - 20)
    If @error Then
        $nOldOpt = Opt('GUIOnEventMode', $nOldOpt)
        Return SetError(2, 0, -1)
    EndIf

    ; Check message will fit
    If $aLabel_Size[2] > $iPopper_W - 20 Or $aLabel_Size[3] > $iPopper_H - 20 Then
        $nOldOpt = Opt('GUIOnEventMode', $nOldOpt)
        Return SetError(3, 0, -1)
    EndIf

    ; Reset Popper and label size to match $iPopper_Fit
    $sMessage = $aLabel_Size[0]
    Local $iLabel_W = $aLabel_Size[2]
    Local $iLabel_H = $aLabel_Size[3]
    Switch $iPopper_Fit
        Case -1
            $iPopper_W = $aLabel_Size[2] + 20
            $iPopper_H = $aLabel_Size[3] + 20
        Case Else
            Switch $iOrient
                Case 0, 2
                    $iPopper_H = $aLabel_Size[3] + 20
                    $iLabel_W = $iPopper_W - 20
                Case Else
                    $iPopper_W = $aLabel_Size[2] + 20
                    $iLabel_H = $iPopper_H - 20
            EndSwitch
    EndSwitch

    ; Set Popper movement and position
    Switch $iOrient
        Case 1
            $aPopper_Move_In  = 0x00040001 ; $AW_SLIDE_IN_LEFT
            $iPopper_Move_Out = 0x00050002 ; $AW_SLIDE_OUT_LEFT
            $iPopper_X = $aGUI_Pos[0] + $aGUI_Pos[2] - 1
            Switch $iPopper_Fit
                Case -1
                    $iPopper_Y = $aGUI_Pos[1] + Int(($aGUI_Pos[3] - $iPopper_H) / 2)
                Case Else
                    $iPopper_Y = $aGUI_Pos[1] + Int($aGUI_Pos[3] * (100 - $iPopper_Fit) / 200)
            EndSwitch
        Case 2
            $aPopper_Move_In  = 0x00040004 ; $AW_SLIDE_IN_TOP
            $iPopper_Move_Out = 0x00050008 ; $AW_SLIDE_OUT_TOP
            Switch $iPopper_Fit
                Case -1
                    $iPopper_X = $aGUI_Pos[0] + Int(($aGUI_Pos[2] - $iPopper_W) / 2)
                Case Else
                    $iPopper_X = $aGUI_Pos[0] + Int($aGUI_Pos[2] * (100 - $iPopper_Fit) / 200)
            EndSwitch
            $iPopper_Y = $aGUI_Pos[1] + $aGUI_Pos[3] - 1
        Case 3
            $aPopper_Move_In  = 0x00040002 ; $AW_SLIDE_IN_RIGHT
            $iPopper_Move_Out = 0x00050001 ; $AW_SLIDE_OUT_RIGHT
            $iPopper_X = $aGUI_Pos[0] - $iPopper_W - 1
            Switch $iPopper_Fit
                Case -1
                    $iPopper_Y = $aGUI_Pos[1] + Int(($aGUI_Pos[3] - $iPopper_H) / 2)
                Case Else
                    $iPopper_Y = $aGUI_Pos[1] + Int($aGUI_Pos[3] * (100 - $iPopper_Fit) / 200)
            EndSwitch
        Case Else
            $iOrient = 0
            $aPopper_Move_In  = 0x00040008 ; $AW_SLIDE_IN_BOTTOM
            $iPopper_Move_Out = 0x00050004 ; $AW_SLIDE_OUT_BOTTOM
            Switch $iPopper_Fit
                Case -1
                    $iPopper_X = $aGUI_Pos[0] + Int(($aGUI_Pos[2] - $iPopper_W) / 2)
                Case Else
                    $iPopper_X = $aGUI_Pos[0] + Int($aGUI_Pos[2] * (100 - $iPopper_Fit) / 200)
            EndSwitch
            $iPopper_Y = $aGUI_Pos[1] - $iPopper_H - 1
    EndSwitch

    ; Create Popper slice with $WS_POPUPWINDOW, $WS_EX_TOOLWINDOW styles
    $hPopper_Handle = GUICreate("", $iPopper_W, $iPopper_H, $iPopper_X, $iPopper_Y, 0x80880000, 0x00000080)
    If @error Then
        $nOldOpt = Opt('GUIOnEventMode', $nOldOpt)
        Return SetError(4, 0, -1)
    EndIf
        GUISetFont($iPopper_Font_Size, Default, Default, $sPopper_Font_Name)
        GUISetBkColor($iPopper_BkCol)

    ; Create Message label
    GUICtrlCreateLabel($sMessage, 10 , 10, $iLabel_W, $iLabel_H)
        GUICtrlSetStyle(-1, $iPopper_Style)
        If $iPopper_Col <> Default Then GUICtrlSetColor(-1, $iPopper_Col)

    ; Slide Popper Slice into view from behind systray and activate
    DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hPopper_Handle, "int", 1000, "long", $aPopper_Move_In)

    ; Activate Popper without stealing focus
    GUISetState(@SW_SHOWNOACTIVATE, $hPopper_Handle)

    ; If script is to pause
    If $fWait = True Then

        ; Begin timeout counter
        Local $iTimeout_Begin = TimerInit()

        ; Wait for timeout or closure
        While 1
            If TimerDiff($iTimeout_Begin) / 1000 >= Abs($iDelay) Then ExitLoop
        WEnd

    EndIf

    ; Reset original mode
    $nOldOpt = Opt('GUIOnEventMode', $nOldOpt)

    Return 1

EndFunc ; => _Popper_Show

; #FUNCTION# ========================================================================================================
; Name...........: _Popper_Hide
; Description ...: Hides a visible slice message behind a GUI
; Syntax.........: _Popper_Hide()
; Requirement(s).: v3.3.1.5 or higher
; Return values .: Success: Returns 0
;                  Failure: If Popper does not exist returns -1 and sets @error to 1
; Author ........: Melba23
; Example........; Yes
;=====================================================================================================================

Func _Popper_Hide()

    ; If no Popper to hide, return
    If $hPopper_Handle = 0 Then Return SetError(1, 0, -1)

    ; Slide Popper back behind systray
    DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hPopper_Handle, "int", 500, "long", $iPopper_Move_Out)

    ; Delete Popper slice
    GUIDelete($hPopper_Handle)

    ; Set flag for "no Popper"
    $hPopper_Handle = 0

EndFunc ; => _Popper_Hide

; #INTERNAL_USE_ONLY#============================================================================================================
; Name...........: _Popper_GetDefFont
; Description ...: Determine system default MsgBox font and size
; Syntax ........: _Popper_GetDefFont($iData)
; Parameters ....: $iData - 0 = Font point size, 1 = Font name
; Author ........: Melba23
; Modified.......:
; Remarks .......: This function is used internally by _Popper functions
; ===============================================================================================================================
Func _Popper_GetDefFont($iData)

    ; Get default system font data
    Local $tNONCLIENTMETRICS = DllStructCreate("uint;int;int;int;int;int;byte[60];int;int;byte[60];int;int;byte[60];byte[60];byte[60]")
    DLLStructSetData($tNONCLIENTMETRICS, 1, DllStructGetSize($tNONCLIENTMETRICS))
    DLLCall("user32.dll", "int", "SystemParametersInfo", "int", 41, "int", DllStructGetSize($tNONCLIENTMETRICS), "ptr", DllStructGetPtr($tNONCLIENTMETRICS), "int", 0)
    ; Read font data for MsgBox font
    Local $tLOGFONT = DllStructCreate("long;long;long;long;long;byte;byte;byte;byte;byte;byte;byte;byte;char[32]", DLLStructGetPtr($tNONCLIENTMETRICS, 15))
    Switch $iData
        Case 0
            ; Font size as integer
            Return Int((Abs(DllStructGetData($tLOGFONT, 1)) + 1) * .75)
        Case 1
            ; Font name
            Return DllStructGetData($tLOGFONT, 14)
    EndSwitch

EndFunc ;=>_Popper_GetDefFont

And an example:

#include <GUIConstantsEx.au3>
#include "Popper.au3"

$hGUI_1 = GUICreate("Test 1", 500, 100, 100, 200)
$hButton = GUICtrlCreateButton("Demo", 10, 10, 80, 30)
GUISetState()

$hGUI_2 = GUICreate("Test 2", 200, 200, 700, 400)
$hLabel = GUICtrlCreateLabel("", 10, 10, 180, 20)
GUISetState()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $hButton
            _Demo()
    EndSwitch
WEnd

Func _Demo()

    ; Left justified, sized to 80% of GUI, colour and font set
    _Popper_Set(0, Default, 0xC0C0C0, 0x00FF00, 15, "Comic Sans MS")
    ; From GUI_1, long text, from top, 1 sec display
    _Popper_Show($hGUI_1, "A fairly long piece of text to fit into a Popper", 0, 1)

    ; Centred , sized to fit text - which makes the justification moot!
    _Popper_Set(1, -1)
    ; From GUI_1, short text, from top, 2 sec display
    _Popper_Show($hGUI_1, "A fitted Popper", 0, 2)

    ; Set right justified, sized to 60% of GUI, colour and font reset
    _Popper_Set(2, 75, 0x80FF80, 0x0000FF, 12, "Arial")
    ; From GUI_2, long text, left side, 2 sec display
    _Popper_Show($hGUI_2, "The text is long but there is space in the Popper", 3, 2)

    ; Set right justified, sized to fit text, same colour and font
    _Popper_Set(2, -1)
    ; From GUI_2, long text, left side, 2 sec display
    _Popper_Show($hGUI_2, "But this Popper is sized to fit the text length", 3, 2)

    ; Centred, sized to 40% of GUI, colour and font reset
    _Popper_Set(1, 40, 0x0000FF, 0xFFFF00, 10, "Consolas")
    ; From GUI_1, short text, from bottom, 1 sec display
    _Popper_Show($hGUI_1, "Short text, medium Popper", 2, 1)

    ; Left justified, sized to fit, default colours and font
    _Popper_Set(0, -1, Default, Default, Default, Default)
    ; From GUI_2, short text, from left, perm display until next Popper_Show/Hide
    _Popper_Show($hGUI_2, "Small sized Popper", 1)

    GUICtrlSetData($hLabel, "And the script continues....")
    Sleep(2000)

    _Popper_Hide()

    GUICtrlSetData($hLabel, "")

EndFunc

It is based on the Toast UDF in my sig - but using GUIs and not the Taskbar.

Give it a try and let me know what you think. :shifty:

M23

Edit: I see Guinness has already mentioned Toast. You might also want to take a look at the GUIExtender UDF in my sig - it offers another way to do something not too dissimilar. :nuke:

Edited by Melba23

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

I was in the midst of creating a UDF too! :x But your approach was a little better of course

Would it be OK to add $WS_EX_MDICHILD to $hPopper_Handle = GUICreate("", $iPopper_W, $iPopper_H, $iPopper_X, $iPopper_Y, 0x80880000, 0x00000080) so the Popups move with the the original GUI

Edit: What else do you have sitting in your Function Folder that you are not telling us about M23?

Edit_2: Typo

Edited by guinness

_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

You are in luck! :x I had just finished a small UDF to do exactly this and you can be the first to try it. :P

Haha really???

Will do! Thanks Melba23!


[font="Comic Sans MS"]My code does not have bugs! It just develops random features.[/font]My Projects[list][*]Live Streaming (Not my project, but my edited version)[right]AutoIt Wrappers![/right][/list]Pure randomness[list][*]Small Minds.......................................................................................................[size="1"]Simple progress bar that changes direction at either sides.[/size][*]ChristmasIt AutoIt Christmas Theme..........................................................[size="1"]I WAS BOOOORED![/size][*]DriveToy..............................................................................................................[size="1"]Simple joke script. Trick your friends into thinking their computer drive is haywire![/size][/list]In Development[list][*]Your Background Task Organiser[*]AInstall Second Generation[/list]BEFORE POSTING ON THE FORUMS, TRY THIS:
%programfiles%/AutoIt3/autoit3.chm

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

guinness,

Would it be OK to add $WS_EX_MDICHILD

Good point, but it will need a bit more work to correctly locate the Poppers if I do that. I will develop that this afternoon - good job the golf course is covered with snow! :shifty:

What else do you have sitting in your Function Folder that you are not telling us about

All sorts of things. :x

But you usually get to see them in the Examples forum once I am happy with them. :P

M23

Edit:

New version of the UDF which has the Poppers moving with their parent GUIs:

#include-once

; #INDEX# ============================================================================================================
; Title .........: Popper
; AutoIt Version : 3.3.2.0
; Language ......: English
; Description ...: Show and hides pop-out messages from behind a GUI in user defined colours and fonts
; Author(s) .....: Melba23.
; ====================================================================================================================

;#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6

; #INCLUDES# =========================================================================================================
#include <StringSize.au3>

; #GLOBAL VARIABLES# =================================================================================================
Global $iDef_Popper_Font_Size   = _Popper_GetDefFont(0)
Global $sDef_Popper_Font_Name   = _Popper_GetDefFont(1)

Global $hPopper_Handle    = 0
Global $iPopper_Move_Out  = 0
Global $iPopper_Style     = 1 ; $SS_CENTER
Global $iPopper_Fit       = 80 ; Max size
Global $aRet = DllCall("User32.dll", "int", "GetSysColor", "int", 8) ; $COLOR_WINDOWTEXT = 8
Global $iPopper_Col       = $aRet[0]
$aRet = DllCall("User32.dll", "int", "GetSysColor", "int", 5) ; $COLOR_WINDOW = 5
Global $iPopper_BkCol     = $aRet[0]
Global $iPopper_Font_Size = $iDef_Popper_Font_Size
Global $sPopper_Font_Name = $sDef_Popper_Font_Name

; #CURRENT# ==========================================================================================================
; _Popper_Set:  Sets text justification and optionally style, colours and font for _Popper_Show function calls
; _Popper_Show: Shows a pop-out message from behind a GUI
; _Popper_Hide: Hides a pop-out message from behind a GUI
; ====================================================================================================================

; #INTERNAL_USE_ONLY#=================================================================================================
; _Popper_GetDefFont:    Determine system default MsgBox font and size
; ====================================================================================================================

; #FUNCTION# =========================================================================================================
; Name...........: _Popper_Set
; Description ...: Sets text justification and optionally colours and font, for _Popper_Show function calls
; Syntax.........: _Popper_Set($vJust, [$iFit, [$iMsg_BkCol, [$iMsg_Col, [$sFont_Size, [$iFont_Name]]]]])
; Parameters ....: $vJust     - 0 = Left justified, 1 = Centred (Default), 2 = Right justified
;                                Can use $SS_LEFT, $SS_CENTER, $SS_RIGHT
;                       >>>>>    Setting this parameter to' Default' will reset ALL parameters to default values     <<<<<
;                       >>>>>    All optional parameters default to system MsgBox default values                     <<<<<
;                  $iFit       - [Optional] Percentage of GUI size to use for Popper (Default = 80%, -1 = Fit to size)
;                  $iMsg_BkCol - [Optional] The colour for the Popper background
;                  $iMsg_Col   - [Optional] The colour for the Popper text
;                                Omitting a colour parameter or setting it to -1 leaves it unchanged
;                                Setting a colour parameter to Default resets the system colour
;                  $iFont_Size - [Optional] The font size in points to use for the Popper
;                  $sFont_Name - [Optional] The font to use for the Popper
;                       >>>>>    Omitting a font parameter, setting size to -1 or name to "" leaves it unchanged     <<<<<
;                       >>>>>    Setting a font parameter to Default resets the system message box font or size      <<<<<
; Requirement(s).: v3.3.2.0 or higher
; Return values .: Success - Returns 1
;                  Failure - Returns 0 and sets @error to 1 with @extended set to parameter index number
; Author ........: Melba23
; Example........; Yes
;=====================================================================================================================

Func _Popper_Set($vJust, $iFit = 80, $iMsg_BkCol = -1, $iMsg_Col = -1, $iFont_Size = -1, $sFont_Name = "")

    ; Set parameters
    Switch $vJust
        Case Default
            $iPopper_Style     = 1; $SS_CENTER
            $iPopper_Fit       = 80
            $aRet = DllCall("User32.dll", "int", "GetSysColor", "int", 8) ; $COLOR_WINDOWTEXT = 8
            $iPopper_Col       = $aRet[0]
            $aRet = DllCall("User32.dll", "int", "GetSysColor", "int", 5) ; $COLOR_WINDOW = 5
            $iPopper_BkCol     = $aRet[0]
            $sPopper_Font_Name = $sDef_Popper_Font_Name
            $iPopper_Font_Size = $iDef_Popper_Font_Size
            Return
        Case 0, 1, 2
            $iPopper_Style = $vJust
        Case -1
            ; Do nothing
        Case Else
            Return SetError(1, 1, 0)
    EndSwitch

    Switch $iFit
        Case Default
            $iPopper_Fit = 80
        Case -1 To 100
            $iPopper_Fit = $iFit
        Case Else
            Return SetError(1, 2, 0)
    EndSwitch

    Switch $iMsg_BkCol
        Case Default
            $aRet = DllCall("User32.dll", "int", "GetSysColor", "int", 5) ; $COLOR_WINDOW = 5
            $iPopper_BkCol  = $aRet[0]
        Case 0 To 0xFFFFFF
            $iPopper_BkCol = Int($iMsg_BkCol)
        Case -1
            ; Do nothing
        Case Else
            Return SetError(1, 3, 0)
    EndSwitch

    Switch $iMsg_Col
        Case Default
            $aRet = DllCall("User32.dll", "int", "GetSysColor", "int", 8) ; $COLOR_WINDOWTEXT = 8
            $iPopper_Col  = $aRet[0]
        Case 0 To 0xFFFFFF
            $iPopper_Col = Int($iMsg_Col)
        Case -1
            ; Do nothing
        Case Else
            Return SetError(1, 4, 0)
    EndSwitch

    Switch $iFont_Size
        Case Default
            $iPopper_Font_Size = $iDef_Popper_Font_Size
        Case 8 To 72
            $iPopper_Font_Size = Int($iFont_Size)
        Case -1
            ; Do nothing
        Case Else
            Return SetError(1, 5, 0)
    EndSwitch

    Switch $sFont_Name
        Case Default
            $sPopper_Font_Name = $sDef_Popper_Font_Name
        Case ""
            ; Do nothing
        Case Else
            If IsString($sFont_Name) Then
                $sPopper_Font_Name = $sFont_Name
            Else
                Return SetError(1, 6, 0)
            EndIf
    EndSwitch

    Return 1

EndFunc ; => _Popper_Set

; #FUNCTION# =========================================================================================================
; Name...........: _Popper_Show
; Description ...: Shows a pop-out message from behind a GUI
; Syntax.........: _Popper_Show($hWnd, $sMessage, [$iOrient, [$iDelay]])
; Parameters ....: $hWnd     - GUI to use
;                  $sMessage - Text to display in Popper body
;                  $iOrient  - position on GUI (0 = Top (default), 1 = Right, 2 = Bottom, 4 = Left)
;                  $iDelay   - The delay in seconds before the Popper retracts (Default = Popper stays visible)
; Requirement(s).: v3.3.1.5 or higher
; Return values .: Success: Returns 2-element array: [Popper width, Popper height]
;                  Failure: Returns -1 and sets @error as follows:
;                           1 = GUI not found or invalid handle
;                           2 = StringSize error
;                           3 = Text too large for max Popper size
;                           4 = Popper creation fail
; Author ........: Melba23
; Notes .........; Any visible Popper is retracted by a subsequent _Popper_Hide or _Popper_Show
; Example........; Yes
;=====================================================================================================================

Func _Popper_Show($hWnd, $sMessage, $iOrient = 0, $iDelay = 0, $fWait = True)

    Local $aPopper_Move_In, $iPopper_X, $iPopper_Y, $iPopper_W, $iPopper_H

    ; Check valid and visible GUI
    If Not(IsHWnd($hWnd)) Or Not(BitAnd(WinGetState($hWnd), 2)) Then Return SetError(1, 0, -1)

    ; Store current GUI mode and set Message mode
    Local $nOldOpt = Opt('GUIOnEventMode', 0)

    ; Retract any Popper already in place
    If $hPopper_Handle <> 0 Then _Popper_Hide()

    ; Get GUI pos and size
    Local $aGUI_Pos = WinGetPos($hWnd)
    ; Get client area position
    Local $tPoint = DllStructCreate("int X;int Y")
    DllStructSetData($tPoint, "X", 0)
    DllStructSetData($tPoint, "Y", 0)
    Local $pPoint = DllStructGetPtr($tPoint)
    DllCall("user32.dll", "bool", "ClientToScreen", "hwnd", $hWnd, "ptr", $pPoint)
    ; Determine position correction factors for Popper
    Local $iFactor_X = $aGUI_Pos[0] - DllStructGetData($tpoint, "X")
    Local $iFactor_Y = $aGUI_Pos[1] - DllStructGetData($tpoint, "Y")

    ; Get max Popper size required
    Switch $iPopper_Fit
        Case 0 To 80
            $iPopper_W = Int($aGUI_Pos[2] * $iPopper_Fit / 100)
            $iPopper_H = Int($aGUI_Pos[3] * $iPopper_Fit / 100)
        Case -1
            $iPopper_W = Int($aGUI_Pos[2] * .8)
            $iPopper_H = Int($aGUI_Pos[3] * .8)
    EndSwitch

    ; Get message label size
    Local $aLabel_Size = _StringSize($sMessage, $iPopper_Font_Size, Default, Default, $sPopper_Font_Name, $iPopper_W - 20)
    If @error Then
        $nOldOpt = Opt('GUIOnEventMode', $nOldOpt)
        Return SetError(2, 0, -1)
    EndIf

    ; Check message will fit
    If $aLabel_Size[2] > $iPopper_W - 20 Or $aLabel_Size[3] > $iPopper_H - 20 Then
        $nOldOpt = Opt('GUIOnEventMode', $nOldOpt)
        Return SetError(3, 0, -1)
    EndIf

    ; Reset Popper and label size to match $iPopper_Fit
    $sMessage = $aLabel_Size[0]
    Local $iLabel_W = $aLabel_Size[2]
    Local $iLabel_H = $aLabel_Size[3]
    Switch $iPopper_Fit
        Case -1
            $iPopper_W = $aLabel_Size[2] + 20
            $iPopper_H = $aLabel_Size[3] + 20
        Case Else
            Switch $iOrient
                Case 0, 2
                    $iPopper_H = $aLabel_Size[3] + 20
                    $iLabel_W = $iPopper_W - 20
                Case Else
                    $iPopper_W = $aLabel_Size[2] + 20
                    $iLabel_H = $iPopper_H - 20
            EndSwitch
    EndSwitch

    ; Set Popper movement and position
    Switch $iOrient
        Case 1
            $aPopper_Move_In  = 0x00040001 ; $AW_SLIDE_IN_LEFT
            $iPopper_Move_Out = 0x00050002 ; $AW_SLIDE_OUT_LEFT
            $iPopper_X = $aGUI_Pos[2] + $iFactor_X - 1
            Switch $iPopper_Fit
                Case -1
                    $iPopper_Y = Int(($aGUI_Pos[3] - $iPopper_H) / 2) + $iFactor_Y
                Case Else
                    $iPopper_Y = Int($aGUI_Pos[3] * (100 - $iPopper_Fit) / 200) + $iFactor_Y
            EndSwitch
        Case 2
            $aPopper_Move_In  = 0x00040004 ; $AW_SLIDE_IN_TOP
            $iPopper_Move_Out = 0x00050008 ; $AW_SLIDE_OUT_TOP
            Switch $iPopper_Fit
                Case -1
                    $iPopper_X = Int(($aGUI_Pos[2] - $iPopper_W) / 2) + $iFactor_X
                Case Else
                    $iPopper_X = Int($aGUI_Pos[2] * (100 - $iPopper_Fit) / 200) + $iFactor_X
            EndSwitch
            $iPopper_Y = $aGUI_Pos[3] + $iFactor_Y - 1
        Case 3
            $aPopper_Move_In  = 0x00040002 ; $AW_SLIDE_IN_RIGHT
            $iPopper_Move_Out = 0x00050001 ; $AW_SLIDE_OUT_RIGHT
            $iPopper_X = $iFactor_X - $iPopper_W - 1
            Switch $iPopper_Fit
                Case -1
                    $iPopper_Y = Int(($aGUI_Pos[3] - $iPopper_H) / 2) + $iFactor_Y
                Case Else
                    $iPopper_Y = Int($aGUI_Pos[3] * (100 - $iPopper_Fit) / 200) + $iFactor_Y
            EndSwitch
        Case Else
            $iOrient = 0
            $aPopper_Move_In  = 0x00040008 ; $AW_SLIDE_IN_BOTTOM
            $iPopper_Move_Out = 0x00050004 ; $AW_SLIDE_OUT_BOTTOM
            Switch $iPopper_Fit
                Case -1
                    $iPopper_X = Int(($aGUI_Pos[2] - $iPopper_W) / 2) + $iFactor_X
                Case Else
                    $iPopper_X = Int($aGUI_Pos[2] * (100 - $iPopper_Fit) / 200) + $iFactor_X
            EndSwitch
            $iPopper_Y = $iFactor_Y - $iPopper_H - 1
    EndSwitch

    ; Create Popper slice with $WS_POPUPWINDOW, $WS_EX_TOOLWINDOW styles
    $hPopper_Handle = GUICreate("", $iPopper_W, $iPopper_H, $iPopper_X, $iPopper_Y, 0x80880000, BitOr(0x00000080, 0x00000040), $hWnd)
    If @error Then
        $nOldOpt = Opt('GUIOnEventMode', $nOldOpt)
        Return SetError(4, 0, -1)
    EndIf
        GUISetFont($iPopper_Font_Size, Default, Default, $sPopper_Font_Name)
        GUISetBkColor($iPopper_BkCol)

    ; Create Message label
    GUICtrlCreateLabel($sMessage, 10 , 10, $iLabel_W, $iLabel_H)
        GUICtrlSetStyle(-1, $iPopper_Style)
        If $iPopper_Col <> Default Then GUICtrlSetColor(-1, $iPopper_Col)

    ; Slide Popper Slice into view from behind systray and activate
    DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hPopper_Handle, "int", 1000, "long", $aPopper_Move_In)

    ; Activate Popper without stealing focus
    GUISetState(@SW_SHOWNOACTIVATE, $hPopper_Handle)

    ; If script is to pause
    If $fWait = True Then

        ; Begin timeout counter
        Local $iTimeout_Begin = TimerInit()

        ; Wait for timeout or closure
        While 1
            If TimerDiff($iTimeout_Begin) / 1000 >= Abs($iDelay) Then ExitLoop
        WEnd

    EndIf

    ; Reset original mode
    $nOldOpt = Opt('GUIOnEventMode', $nOldOpt)

    Return 1

EndFunc ; => _Popper_Show

; #FUNCTION# ========================================================================================================
; Name...........: _Popper_Hide
; Description ...: Hides a visible slice message behind a GUI
; Syntax.........: _Popper_Hide()
; Requirement(s).: v3.3.1.5 or higher
; Return values .: Success: Returns 0
;                  Failure: If Popper does not exist returns -1 and sets @error to 1
; Author ........: Melba23
; Example........; Yes
;=====================================================================================================================

Func _Popper_Hide()

    ; If no Popper to hide, return
    If $hPopper_Handle = 0 Then Return SetError(1, 0, -1)

    ; Slide Popper back behind systray
    DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $hPopper_Handle, "int", 500, "long", $iPopper_Move_Out)

    ; Delete Popper slice
    GUIDelete($hPopper_Handle)

    ; Set flag for "no Popper"
    $hPopper_Handle = 0

EndFunc ; => _Popper_Hide

; #INTERNAL_USE_ONLY#============================================================================================================
; Name...........: _Popper_GetDefFont
; Description ...: Determine system default MsgBox font and size
; Syntax ........: _Popper_GetDefFont($iData)
; Parameters ....: $iData - 0 = Font point size, 1 = Font name
; Author ........: Melba23
; Modified.......:
; Remarks .......: This function is used internally by _Popper functions
; ===============================================================================================================================
Func _Popper_GetDefFont($iData)

    ; Get default system font data
    Local $tNONCLIENTMETRICS = DllStructCreate("uint;int;int;int;int;int;byte[60];int;int;byte[60];int;int;byte[60];byte[60];byte[60]")
    DLLStructSetData($tNONCLIENTMETRICS, 1, DllStructGetSize($tNONCLIENTMETRICS))
    DLLCall("user32.dll", "int", "SystemParametersInfo", "int", 41, "int", DllStructGetSize($tNONCLIENTMETRICS), "ptr", DllStructGetPtr($tNONCLIENTMETRICS), "int", 0)
    ; Read font data for MsgBox font
    Local $tLOGFONT = DllStructCreate("long;long;long;long;long;byte;byte;byte;byte;byte;byte;byte;byte;char[32]", DLLStructGetPtr($tNONCLIENTMETRICS, 15))
    Switch $iData
        Case 0
            ; Font size as integer
            Return Int((Abs(DllStructGetData($tLOGFONT, 1)) + 1) * .75)
        Case 1
            ; Font name
            Return DllStructGetData($tLOGFONT, 14)
    EndSwitch

EndFunc ;=>_Popper_GetDefFont
Edited by Melba23

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites

shanet,

it doesnt like setting poppers above 80% of the GUI size. Is this done on purpose?

Yes - it seemed foolish to have a Popper that was larger then the GUI from which it emerged. :P However, you do get a specific error if the text is too large for the Popper.

it would be good if you could handle it almost like a GUI and put controls on it and change the size height-wise

I designed this UDF to display Poppers with short text messages. If you want to have additional controls on a new part of the GUI, do take a look at the GUIExtender UDF in my sig to which I pointed you earlier. It allows you to have parts of your GUI extend and retract as you wish - you can have any controls you want on the extendable sections. :x

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

I previously did this for - Melba23 & - Zedna

For those who use the full version of SciTe and wish for the following commands to show in the command popup box, I have created entries for <au3.user.calltips.api> and <au3.userudfs.properties> (Located in the api and properties folders)

All I had to do with this UDF is simple copy and paste what was already in the comments of the functions.

Add the following to <au3.user.calltips.api>

_Popper_Set($vJust, [$iFit, [$iMsg_BkCol, [$iMsg_Col, [$sFont_Size, [$iFont_Name]]]]]) Sets text justification and optionally colours and font, for _Popper_Show function calls (Requires: #Include <Popper.au3>)
_Popper_Show($hWnd, $sMessage, [$iOrient, [$iDelay]]) Shows a pop-out message from behind a GUI (Requires: #Include <Popper.au3>)
_Popper_Hide() Hides a visible slice message behind a GUI (Requires: #Include <Popper.au3>)

Add the following to <au3.userudfs.properties>

au3.keywords.user.udfs=_popper_hide _popper_set _popper_show

Thanks for taking into consideration my suggestion, I was going to add it in an unofficial version :x

Edited by guinness

_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

I designed this UDF to display Poppers with short text messages. If you want to have additional controls on a new part of the GUI, do take a look at the GUIExtender UDF in my sig to which I pointed you earlier.

Wow! That looks perfect!

I downloaded one of your examples and it looks simply amazing!

Thanks Melba23.

shanet


[font="Comic Sans MS"]My code does not have bugs! It just develops random features.[/font]My Projects[list][*]Live Streaming (Not my project, but my edited version)[right]AutoIt Wrappers![/right][/list]Pure randomness[list][*]Small Minds.......................................................................................................[size="1"]Simple progress bar that changes direction at either sides.[/size][*]ChristmasIt AutoIt Christmas Theme..........................................................[size="1"]I WAS BOOOORED![/size][*]DriveToy..............................................................................................................[size="1"]Simple joke script. Trick your friends into thinking their computer drive is haywire![/size][/list]In Development[list][*]Your Background Task Organiser[*]AInstall Second Generation[/list]BEFORE POSTING ON THE FORUMS, TRY THIS:
%programfiles%/AutoIt3/autoit3.chm

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  
Followers 0