Jump to content
Melba23

Extended Message Box - New Version: 2 Aug 18

Recommended Posts

Monooboe

Melba32,

thanks for you tips.

Initial position of EMB was read from INI file.  EMB may be moved per preference ( top or bottom of screen) and wants to save new position to INI file .

Can you tell me how to trigger recent position of EMB instead of "GUIRegisterMsg" after moved from previous position?

;remember last position
GUIRegisterMsg(0x03, "LASTPOST")

thanks again

Monooboe

Share this post


Link to post
Share on other sites
Melba23

Monooboe,

As you create the EMB you can just copy the values to the ini at that point:

; Create GUI with $WS_POPUPWINDOW, $WS_CAPTION style and required extended style
Local $hMsgGUI = GUICreate($sTitle, $iDialog_Width, $iMsg_Height, $iHpos, $iVPos, BitOR(0x80880000, 0x00C00000), $iExtStyle, $iParent_Win)
If @error Then
    Return SetError(7, 0, -1)
Else
    IniWrite($Config, 'LPEXMSG', 'XPOS', $iHpos)
    IniWrite($Config, 'LPEXMSG', 'YPOS', $iVPos)
EndIf

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
Rex
Posted (edited)

Hi Melba32

Thx for this cools UDF. though I have one problem

Using this

_ExtMsgBoxSet(Default, Default, 0x008000, 0xFF8000, 12, "MS Sans Serif")

The colors is not used.

Wouldn't it normally just replace the Default keyword with the default parameter values?

btw. I'm using the latest Autoit beta, don't know if that could be the problem :(

Cheers
/Rex

Edited by Rex
Forgot to add what the problem was :$

Share this post


Link to post
Share on other sites
Melba23

Rex,

From the _ExtMsgBoxSet header:

;Setting the $iStyle parameter to 'Default' resets ALL parameters to default values <<<<<<<<<<<<<<<<<<<<<<<

So use:

_ExtMsgBoxSet(0, Default, 0x008000, 0xFF8000, 12, "MS Sans Serif")

And you will get the colours.

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
Rex

 :doh:I really need to read, and then understand, what's written. :>

Thx for clearing that one up :)

Cheers
/Rex

Share this post


Link to post
Share on other sites
Monooboe
Posted (edited)

Hi Melba23,

thanks for your help.

When I  add this line in your script and run my script, it showed warning message "$Config: possible used before declaration" .

I have already declared in my main script.

; Create GUI with $WS_POPUPWINDOW, $WS_CAPTION style and required extended style
Local $hMsgGUI = GUICreate($sTitle, $iDialog_Width, $iMsg_Height, $iHpos, $iVPos, BitOR(0x80880000, 0x00C00000), $iExtStyle, $iParent_Win)
If @error Then
    Return SetError(7, 0, -1)
Else
    IniWrite($Config, 'LPEXMSG', 'XPOS', $iHpos)
    IniWrite($Config, 'LPEXMSG', 'YPOS', $iVPos)
EndIf

Sorry for confusion about saving Last Position. 

EMB was started with Center of screen ( initial settings in INI) .  It will be moved to top or bottom of screen that depends on user's preference.

with my previous modification in EMB, last position of EMB was saved in INI file after move.  Next time when I use my script, EMB showed at the bottom or top of screen instead of Center of screen.

GUIRegisterMsg(0x03, "LASTPOST")

Can you tell me how to save last position for EMB after moved instead of using "GUIRegisterMsg" ?

here is part of my script.

#include "ExtMsgBox.au3"

#include <File.au3>

 

Global $Config = @ScriptDir & "\config.ini"

$chkF=FileExists($Config)

if $chkF = 0 then

                IniWrite($Config, 'LPEXMSG', 'XPOS', Int(@DesktopWidth / 2))

                IniWrite($Config, 'LPEXMSG', 'YPOS', Int(@DesktopHeight / 2))

endif

 

selection()

 

Func selection()

                Local $emXPos = Int(IniRead($Config, 'LPEXMSG', 'XPOS', '')) ;ready to close position

                Local $emYPos = Int(IniRead($Config, 'LPEXMSG', 'YPOS', '')) ;ready to close position

 

                _ExtMsgBoxSet(32 + 64, 2, 0x004080, 0xFFFF00, 10, "Comic Sans MS")

                ; message for text body

                $sMsg = '"Message for text body'

                $iRetValue = _ExtMsgBox($EMB_ICONEXCLAM, "&Continue|&Skip|E&xit", "click 'Continue' to save current file.|click 'Skip' saving |click 'Exit' to Quit!", "Ready to Complete", $sMsg, 0, $emXPos, $emYPos)

                If $iRetValue = 2 Then

                                MsgBox(4096, 'Skip', ' "Skip" to save')

                ElseIf $iRetValue = 3 Then

                                Exit

                ElseIf $iRetValue = 1 Then

                                MsgBox(4096, 'Continue', 'save current file')

                EndIf

 

EndFunc

 

 

 

Func LASTPOST($hWnd, $nMsg, $wParam, $lParam)

                Local $aWPos = WinGetPos($hWnd)

                If IsArray($aWPos) Then

                                ;$aWPos = WinGetPos("")

                                IniWrite($Config, 'LPEXMSG', 'XPOS', $aWPos[0])

                                IniWrite($Config, 'LPEXMSG', 'YPOS', $aWPos[1])

                                $emXPos = $aWPos[0]

                                $emYPos = $aWPos[1]

                EndIf

                Return

EndFunc

Thanks

Monooboe

Edited by Monooboe

Share this post


Link to post
Share on other sites
Melba23
Posted (edited)

Monooboe,

You need to define the ini file before the EMB include so that the path variable is defined within the UDF. Then you can do this:

Global $Config = @ScriptDir & "\config.ini"

FileDelete($Config) ; Just to make sure we do not have an ini to start

Global $emXPos, $emYPos

#include "ExtMsgBox.au3"
#include <File.au3>

$chkF = FileExists($Config)
If $chkF Then
    $emXPos = Int(IniRead($Config, 'LPEXMSG', 'XPOS', '')) ;ready to close position
    $emYPos = Int(IniRead($Config, 'LPEXMSG', 'YPOS', '')) ;ready to close position
Else
    $emXPos = Int(@DesktopWidth / 2)
    $emYPos = Int(@DesktopHeight / 2)
    IniWrite($Config, 'LPEXMSG', 'XPOS', $emXPos)
    IniWrite($Config, 'LPEXMSG', 'YPOS', $emYPos)
EndIf

; This will be around the centre of the screen
selection()

; Set the new coords to top-left
$emXPos = 100
$emYPos = 100

; And that is where it appears
selection()

; Read from the ini
$emXPos = Int(IniRead($Config, 'LPEXMSG', 'XPOS', ''))
$emYPos = Int(IniRead($Config, 'LPEXMSG', 'YPOS', ''))

; And we get it in the same position
selection()

Func selection()
    _ExtMsgBoxSet(32 + 64, 2, 0x004080, 0xFFFF00, 10, "Comic Sans MS")
    ; message for text body
    $sMsg = '"Message for text body'
    $iRetValue = _ExtMsgBox($EMB_ICONEXCLAM, "&Continue|&Skip|E&xit", "Ready to Complete", $sMsg, 0, $emXPos, $emYPos)
    IniWrite($Config, 'LPEXMSG', 'XPOS', $emXPos)
    IniWrite($Config, 'LPEXMSG', 'YPOS', $emYPos)
    If $iRetValue = 2 Then
        MsgBox(4096, 'Skip', ' "Skip" to save')
    ElseIf $iRetValue = 3 Then
        Exit
    ElseIf $iRetValue = 1 Then
        MsgBox(4096, 'Continue', 'save current file')
    EndIf
EndFunc   ;==>selection

All clear?

M23

Edit: As this is modifying the main UDF and I am not going to support it in the future, if we need to go on any longer I shall split off these posts into a separate thread.

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
Monooboe

thanks

Share this post


Link to post
Share on other sites
Melba23

[NEW VERSION] 2 Aug 18

Added: When specifying the icon to use, if the $vIcon parameter is set to the name of an ico or exe file, the main icon within will be displayed, but if a trailing "|" followed by the icon index is added to the name, that icon from within the file is used.

New UDF and examples in the first post.

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

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

×