Jump to content

MSGBOX HELP!


Recommended Posts

  • Moderators

JuanFelipe,

Look at my ExtMsgBox UDF - the link is in my sig below.

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

JuanFelipe,

Look at my ExtMsgBox UDF - the link is in my sig below.

M23

Melba is wonderful, thank you very much. Excuse my ignorance as I am a little new, you could explain me with an example like this:

msgbox (64, "Hello", "Want morning or afternoon?")

Then the buttons I need are the two options that I have the text.

Link to comment
Share on other sites

  • Moderators

JuanFelipe,

The function headers in the UDF explain very clearly how to set the various parameters - as you can see here:

; #FUNCTION# =========================================================================================================
; Name...........: _ExtMsgBox
; Description ...: Generates user defined message boxes centred on a GUI, the desktop, or at defined coordinates
; Syntax.........: _ExtMsgBox ($vIcon, $vButton, $sTitle, $sText, [$iTimeout, [$hWin, [$iVPos, [$bMain = True[]]])
; Parameters ....: $vIcon   -> Icon to use:
;                                      0   - No icon
;                                      8   - UAC
;                                      16  - Stop         )
;                                      32  - Query        ) or equivalent $MB/$EMB_ICON constant
;                                      48  - Exclamation  )
;                                      64  - Information  )
;                                      128 - Countdown digits if $iTimeout set
;                                      Any other numeric value returns Error 1
;                                   Full path and name of exe - main exe icon displayed
;                                   Full path and name of icon - icon displayed
;                   $vButton  -> Button text separated with "|" character. " " = no buttons.
;                                      An ampersand (&) before the text indicates the default button.
;                                      Two focus ampersands returns Error 2. A single button is always default
;                                      Pressing Enter or Space fires default button
;                                      Can also use $MB_ button numeric constants: 0 = "OK", 1 = "&OK|Cancel",
;                                      2 = "&Abort|Retry|Ignore", 3 = "&Yes|No|Cancel", 4 = "&Yes|No", 5 = "&Retry|Cancel",
;                                      6 = "&Cancel|Try Again|Continue".  Other values returns Error 3
;                                      Default max width of 370 gives 1-4 buttons @ width 80, 5 @ width 60, 6 @ width 50
;                                      Min button width set at 50, so unless defaults changed 7 buttons returns Error 4
;                   $sTitle   -> The title of the message box.
;                                      Procrustean truncation if too long to fit
;                   $sText    -> The text to be displayed. Long lines will wrap. The box depth is adjusted to fit.
;                                      If unbroken character strings in $sText too long for set max width,
;                                      EMB expands to set absolute width. Error 6 if still not able to fit
;                   $iTimeout -> Timeout delay before EMB closes. 0 = no timeout (Default).
;                                      If no buttons and no timeout set, delay automatically set to 5
;                   $hWin     -> Handle of the GUI in which EMB is centred
;                                      If GUI  hidden or no handle passed - EMB centred in desktop (Default)
;                                      If not valid window handle, interpreted as horizontal coordinate for EMB location
;                   $iVPos    -> Vertical coordinate for EMB location
;                                      Only valid if $hWin parameter interpreted as horizontal coordinate (Default = 0)
;                   $bMain    -> True (default) = Adjust dialog position to ensure dialog positioned on main screen
;                                      False = Dialog positioned at defined coords
; Requirement(s).: v3.2.12.1 or higher
; Return values .: Success: Returns 1-based index of the button pressed, counting from the LEFT.
;                           Returns 0 if closed by a "CloseGUI" event (i.e. click [X] or press Escape)
;                           Returns 9 if timed out
;                           If "Not again" checkbox is present and checked, return value is negated
;                  Failure: Returns -1 and sets @error as follows:
;                               1 - Icon error
;                               2 - Multiple default button error
;                               3 - Button constant error
;                               4 - Too many buttons to fit in max available EMB width
;                               5 - Button text too long for max available button width
;                               6 - StringSize error
;                               7 - GUI creation error
; Remarks .......; If $bMain set EMB adjusted to appear on main screen closest to required position
; Author ........: Melba23, based on some original code by photonbuddy & YellowLab
; Example........; Yes
;=====================================================================================================================

But here is the example you requested:

#include <MsgBoxConstants.au3>

#include "ExtMsgBox.au3"

$iRet = _ExtMsgBox($EMB_ICONINFO, "Morning|Afternoon", "Hello", "Want morning or afternoon?")

Switch $iRet

    Case 1
        MsgBox($MB_SYSTEMMODAL, "Pressed", "Morning")
    Case 2
        MsgBox($MB_SYSTEMMODAL, "Pressed", "Afternoon")
    Case Else
        MsgBox($MB_SYSTEMMODAL, "Error", "Cancelled")
EndSwitch

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

JuanFelipe,

The function headers in the UDF explain very clearly how to set the various parameters - as you can see here:

; #FUNCTION# =========================================================================================================
; Name...........: _ExtMsgBox
; Description ...: Generates user defined message boxes centred on a GUI, the desktop, or at defined coordinates
; Syntax.........: _ExtMsgBox ($vIcon, $vButton, $sTitle, $sText, [$iTimeout, [$hWin, [$iVPos, [$bMain = True[]]])
; Parameters ....: $vIcon   -> Icon to use:
;                                      0   - No icon
;                                      8   - UAC
;                                      16  - Stop         )
;                                      32  - Query        ) or equivalent $MB/$EMB_ICON constant
;                                      48  - Exclamation  )
;                                      64  - Information  )
;                                      128 - Countdown digits if $iTimeout set
;                                      Any other numeric value returns Error 1
;                                   Full path and name of exe - main exe icon displayed
;                                   Full path and name of icon - icon displayed
;                   $vButton  -> Button text separated with "|" character. " " = no buttons.
;                                      An ampersand (&) before the text indicates the default button.
;                                      Two focus ampersands returns Error 2. A single button is always default
;                                      Pressing Enter or Space fires default button
;                                      Can also use $MB_ button numeric constants: 0 = "OK", 1 = "&OK|Cancel",
;                                      2 = "&Abort|Retry|Ignore", 3 = "&Yes|No|Cancel", 4 = "&Yes|No", 5 = "&Retry|Cancel",
;                                      6 = "&Cancel|Try Again|Continue".  Other values returns Error 3
;                                      Default max width of 370 gives 1-4 buttons @ width 80, 5 @ width 60, 6 @ width 50
;                                      Min button width set at 50, so unless defaults changed 7 buttons returns Error 4
;                   $sTitle   -> The title of the message box.
;                                      Procrustean truncation if too long to fit
;                   $sText    -> The text to be displayed. Long lines will wrap. The box depth is adjusted to fit.
;                                      If unbroken character strings in $sText too long for set max width,
;                                      EMB expands to set absolute width. Error 6 if still not able to fit
;                   $iTimeout -> Timeout delay before EMB closes. 0 = no timeout (Default).
;                                      If no buttons and no timeout set, delay automatically set to 5
;                   $hWin     -> Handle of the GUI in which EMB is centred
;                                      If GUI  hidden or no handle passed - EMB centred in desktop (Default)
;                                      If not valid window handle, interpreted as horizontal coordinate for EMB location
;                   $iVPos    -> Vertical coordinate for EMB location
;                                      Only valid if $hWin parameter interpreted as horizontal coordinate (Default = 0)
;                   $bMain    -> True (default) = Adjust dialog position to ensure dialog positioned on main screen
;                                      False = Dialog positioned at defined coords
; Requirement(s).: v3.2.12.1 or higher
; Return values .: Success: Returns 1-based index of the button pressed, counting from the LEFT.
;                           Returns 0 if closed by a "CloseGUI" event (i.e. click [X] or press Escape)
;                           Returns 9 if timed out
;                           If "Not again" checkbox is present and checked, return value is negated
;                  Failure: Returns -1 and sets @error as follows:
;                               1 - Icon error
;                               2 - Multiple default button error
;                               3 - Button constant error
;                               4 - Too many buttons to fit in max available EMB width
;                               5 - Button text too long for max available button width
;                               6 - StringSize error
;                               7 - GUI creation error
; Remarks .......; If $bMain set EMB adjusted to appear on main screen closest to required position
; Author ........: Melba23, based on some original code by photonbuddy & YellowLab
; Example........; Yes
;=====================================================================================================================

But here is the example you requested:

#include <MsgBoxConstants.au3>

#include "ExtMsgBox.au3"

$iRet = _ExtMsgBox($EMB_ICONINFO, "Morning|Afternoon", "Hello", "Want morning or afternoon?")

Switch $iRet

    Case 1
        MsgBox($MB_SYSTEMMODAL, "Pressed", "Morning")
    Case 2
        MsgBox($MB_SYSTEMMODAL, "Pressed", "Afternoon")
    Case Else
        MsgBox($MB_SYSTEMMODAL, "Error", "Cancelled")
EndSwitch

M23

Thank you, thank you very much, Melba are admirable. Will study the function again. 

Link to comment
Share on other sites

Yes, M23 already has wings. The aureole comes a bit later.

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

  • Moderators

JuanFelipe,

Glad I could help.

When you reply in future, please use the "Reply to this topic" button at the top of the thread or the "Reply to this topic" editor at the bottom rather than the "Quote" button - I know what I wrote and it just pads the thread unnecessarily.

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

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

×
×
  • Create New...