Jump to content

Recommended Posts

  • Moderators
Posted

kashamalasha,

Not at the moment. But it would not be too hard to do as the code is very similar to that used in my Notify UDF which will display images. Give me a moment and I will see what I can do.

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

 

  • Moderators
Posted (edited)

kashamalasha,

This works for me - how about you?

 

M23

Edited by Melba23
Beta code removed

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

 

  • 1 month later...
  • 1 month later...
Posted (edited)

I'm having a problem, when I use a msgbox and click a button so it dissapears, I can't click "X" close the GUI, it takes around 5 seconds

after I closed the msgbox till i can exit the GUI by clicking X.

 

But all in all, a very nice UDF :). and merry christmas by the way

Edited by legend
  • Moderators
Posted (edited)

legend,

If you can provide a reproducer script which shows the problem, I can investigate. Otherwise I am at a loss to help - particularly as this problem has never been mentioned before and I can think of no reason why it should happen.

M23

Edit: I can close the GUI immediately after the ExtMsgBox in this script:

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

$hGUI = GUICreate("Test", 500, 500)
$cButton = GUICtrlCreateButton("ExtMsgBox", 10, 10, 80, 30)
GUISetState()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $cButton
            _ExtMsgBox(0, "OK", "Test", "Can you close the GUI immediately after closing this dialog?")
    EndSwitch
WEnd

How about you?

Edited by Melba23

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

 

  • 1 month later...
Posted

[Bug?]

When supplying a form to center the message box on. This feature only seems to work, if the form is on the main window? Say if you have 3 monitors, if you call it from the primary monitor, works as expected, but move the form to another monitor. The msgbox shows only on the primary? Does seem to show in the correct location should the form be on that monitor however. I tried to see if this was reported but couldn't find anything.

 

Spoiler

WinSizer 2.1 (01/04/2017) - Download - [ Windows Layout Manager ]
Folder+Program (12/23/2016) - Download - [ USB Shortcut Creator ]

 

  • Moderators
Posted

zone97,

This has indeed been reported before - and the UDF was modified to deal with it. Set the $bMain parameter to False and you should be good to go.

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

 

  • Moderators
Posted

zone97,

It is explained in the ExtMsgBox function header:

;                   $bMain    -> True (default) = Adjust dialog position to ensure dialog positioned on main screen
;                                      False = Dialog positioned at defined coords

I often wonder why I go to bother of writing such detailed headers as no-one ever seems to read them.....

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

 

Posted

Melba23,

OK, I understand but in lay-mans terms, that doesn't say anything about addressing multiple monitors?  What that says to me, is center on main screen or? place somewhere else for some other reason? But don't feel as if your efforts go unappreciated. Your work is excellent. 

I read a post with valuable words of wisdom.. You are only responsible for what you say, not what I understand..

 

Spoiler

WinSizer 2.1 (01/04/2017) - Download - [ Windows Layout Manager ]
Folder+Program (12/23/2016) - Download - [ USB Shortcut Creator ]

 

  • Moderators
Posted

zone97,

Firstly, did setting the $bMain parameter to False solve the problem you were having? If not, then there is obviously a deeper problem and I need to do more debugging.

Next, I understand you that you do not understand the comments I wrote to explain the usage of that parameter. Does the following make it clearer to you:

;                   $bMain    -> True (default) = Adjust dialog position to ensure dialog positioned on main screen
;                                False = Dialog positioned at user-defined coords, which can be on other screens

if not, what would you suggest?

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

 

Posted

Yes, it did solve my issue. And Thank you again..

Yes, that's much clearer. 

 

Spoiler

WinSizer 2.1 (01/04/2017) - Download - [ Windows Layout Manager ]
Folder+Program (12/23/2016) - Download - [ USB Shortcut Creator ]

 

  • Moderators
Posted

[NEW VERSION] 16 Feb 17

New: EMBs can now show images (32x32 only - just use the full path as the parameter)

New UDF and examples in first post.

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

 

  • 1 month later...
Posted

Taking ExtMsgBox_Example_1.au3 using

Case $hButton3

            ; Set the message box right justification, colours (yellow text on blue background) and change font
            _ExtMsgBoxSet(1, 2, 0x004080, 0xFFFF00, 10, "Comic Sans MS", @DesktopWidth * 0.5)

            $sMsg = "This is centred on 'EMB Test' with an Exclamation icon, 2 buttons, wrapped right justified coloured text, "
            $sMsg &= "coloured background, no Taskbar button and TOPMOST set" & @CRLF & @CRLF
            $sMsg &= "Note you can get && in button text" & @CRLF
            $sMsg &= "and neither button is set as default" & @CRLF & @CRLF
            $sMsg &= "It will not time out"

            ; Use $MB_ constant
            $iRetValue = _ExtMsgBox($EMB_ICONEXCLAM, "One Way|To && Fro", "Test 3", $sMsg, 0, $hTest_GUI)

works as expected and I can set  $iWidth_Abs to choice but with my adaptation

_ExtMsgBoxSet(1, 0, 0xE0FFFF, 0x5D233E, 10, "Comic Sans MS", 800);$DeskTopW * 0.8)
      $sMsg = $aElements[6][4] & @TAB & $aElements[6][5]& @TAB & $aElements[6][9] & @TAB & $aElements[6][10] & @CRLF _
      & $aElements[7][4] & @TAB & $aElements[7][5]& @TAB & $aElements[7][9] & @TAB & $aElements[7][10]& @CRLF _
      & $aElements[8][4] & @TAB & $aElements[8][5]& @TAB & $aElements[8][9] & @TAB & $aElements[8][10]& @CRLF _
      & $aElements[9][4] & @TAB & $aElements[9][5]& @TAB & $aElements[9][9] & @TAB & $aElements[9][10]& @CRLF _
      & $aElements[10][4] & @TAB & $aElements[10][5]& @TAB & $aElements[10][9] & @TAB & $aElements[10][10]& @CRLF _
      & $aElements[11][4] & @TAB & $aElements[11][5]& @TAB & $aElements[11][9] & @TAB & $aElements[11][10]& @CRLF _
      & $aElements[12][4] & @TAB & $aElements[12][5]& @TAB & $aElements[12][9] & @TAB & $aElements[12][10]& @CRLF _
      & $aElements[13][4] & @TAB & $aElements[13][5]& @TAB & $aElements[13][9] & @TAB & $aElements[13][10]& @CRLF _
      & $aElements[14][4] & @TAB & $aElements[14][5]& @TAB & $aElements[14][9] & @TAB & $aElements[14][10]& @CRLF _
      & $aElements[15][4] & @TAB & $aElements[15][5]& @TAB & $aElements[15][9] & @TAB & $aElements[15][10]& @CRLF _
      & $aElements[16][4] & @TAB & $aElements[16][5]& @TAB & $aElements[16][9] & @TAB & $aElements[16][10]& @CRLF _
      & $aElements[17][4] & @TAB & $aElements[17][5]& @TAB & $aElements[17][9] & @TAB & $aElements[17][10]& @CRLF
  $iRetValue = _ExtMsgBox(0, "&Done|Print", "Data Results", $sMsg, 0, $hGUI)

$iWidth_Abs adjustment has no effect so width is always 370? pixels.

Is this because I am inserting variables instead of text?

The most powerful number in the Universe.  Zero.

  • Moderators
Posted

 fopetesl,

You have tabs in your message, so when setting the EMB data you need to tell the UDF to expand them - as is explained in the function header:

; Parameters ....: $iStyle      -> 0 (Default) - Taskbar Button, TOPMOST, button in user font, no tab expansion,
;                                  ...
;                                  8   = Expand Tabs to ensure adequate sizing of GUI

So your setting line should start:

_ExtMsgBoxSet(1 + 8,...

Now the UDF will expand the tabs correctly and the EMB will expand to fit the whole message without wrapping (as long as the data will fit the specified max width).

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

 

Posted (edited)

I should have RTFM! However, now I seem not to be able to control the box size with $iWidth and/or $iWidth_Abs.

With this code

_ExtMsgBoxSet(1+8, 0, 0xE0FFFF, 0x5D233E, 10, "Comic Sans MS",800,800) ;$DeskTopW * 0.9)
      $sMsg = "Hauteur" & @TAB & @TAB & @TAB & "Barbe" & @CRLF _
       & $aElements[6][4] & @TAB & $aElements[6][5] & @TAB & @TAB & @TAB & $aElements[6][9] & @TAB & $aElements[6][10] & @CRLF _
       & $aElements[7][4] & @TAB & $aElements[7][5] & @TAB & @TAB & @TAB & $aElements[7][9] & @TAB & $aElements[7][10] & @CRLF _
       & $aElements[8][4] & @TAB & $aElements[8][5] & @TAB & $aElements[8][6] & @TAB & $aElements[8][7] & @TAB _
       & $aElements[8][9] & @TAB & $aElements[8][10] & @TAB & $aElements[8][11] & @TAB & $aElements[8][12] & @CRLF _
       & $aElements[9][4] & @TAB & $aElements[9][5] & @TAB & $aElements[9][6] & @TAB & $aElements[9][7] & @TAB _
       & $aElements[9][9] & @TAB & $aElements[9][10] & @TAB & $aElements[9][11] & @TAB & $aElements[9][12] & @CRLF _
       & $aElements[10][4] & @TAB & $aElements[10][5] & @TAB & $aElements[10][6] & @TAB & $aElements[10][7] & @TAB _
       & $aElements[10][9] & @TAB & $aElements[10][10] & @TAB & $aElements[10][11] & @TAB & $aElements[10][12] & @CRLF _
       & $aElements[11][4] & @TAB & $aElements[11][5] & @TAB & $aElements[11][6] & @TAB & $aElements[11][7] & @TAB _
       & $aElements[11][9] & @TAB & $aElements[11][10] & @TAB & $aElements[11][11] & @TAB & $aElements[11][12] & @CRLF _
       & $aElements[12][4] & @TAB & $aElements[12][5] & @TAB & $aElements[12][6] & @TAB & $aElements[12][7] & @TAB _
       & $aElements[12][9] & @TAB & $aElements[12][10] & @TAB & $aElements[12][11] & @TAB & $aElements[12][12] & @CRLF _
       & $aElements[13][4] & @TAB & $aElements[13][5] & @TAB & $aElements[13][6] & @TAB & $aElements[13][7] & @TAB _
       & $aElements[13][9] & @TAB & $aElements[13][10] & @TAB & $aElements[13][11] & @TAB & $aElements[13][12] & @CRLF _
       & $aElements[14][4] & @TAB & $aElements[14][5] & @TAB & $aElements[14][6] & @TAB & $aElements[14][7] & @TAB _
       & $aElements[14][9] & @TAB & $aElements[14][10] & @TAB & $aElements[14][11] & @TAB & $aElements[14][12] & @CRLF _
       & $aElements[15][4] & @TAB & $aElements[15][5] & @TAB & $aElements[15][6] & @TAB & $aElements[15][7] & @TAB _
       & $aElements[15][9] & @TAB & $aElements[15][10] & @TAB & $aElements[15][11] & @TAB & $aElements[15][12] & @CRLF _
       & $aElements[16][4] & @TAB & $aElements[16][5] & @TAB & $aElements[16][6] & @TAB & $aElements[16][7] & @TAB _
       & $aElements[16][9] & @TAB & $aElements[16][10] & @TAB & $aElements[16][11] & @TAB & $aElements[16][12] & @CRLF

  $iRetValue = _ExtMsgBox(0, "&Done|Print", "Data Results", $sMsg, 0, $hGUI)

I get: ExtMsgBox(1).jpg

If I use this code

_ExtMsgBoxSet(1+8, 0, 0xE0FFFF, 0x5D233E, 10, "Comic Sans MS",800) ;$DeskTopW * 0.9)
      $sMsg=

I see the same result. If I adjust $iWidth or &iWidth_Abs. e.g

_ExtMsgBoxSet(1+8, 0, 0xE0FFFF, 0x5D233E, 10, "Comic Sans MS",500) ;$DeskTopW * 0.9)
      $sMsg =

the result is: ExtMsgBox(2).jpg

 

In your (excellent) examples the overall box size adjusts to message text size but mine does not, even if I just use "_ExtMsgBoxSet(1+8)"

So I either have not RTFM properly or I have a code gaff.

ExtMsgBox(1).jpg

ExtMsgBox(2).jpg

Edited by fopetesl
pictures not in place

The most powerful number in the Universe.  Zero.

  • Moderators
Posted (edited)

fopetesl,

The problem is your use of @TABs within the string to display. The UDF uses the GetTextExtentPoint32W DLL call to get the width of the text and this function is not too keen on accurately expanding @TABs. So if asked, the UDF replaces any @TAB character with " XXXXXXXX" when measuring but displays with the original tabs. This ensures that the EMB is always at least wide enough to contain the text - but often at the expense of being too wide (as in first of your images). Trying to reduce the max width of the EMB (as in the second image) will merely force the text to be wrapped.

The discussion earlier in the thread where it was discussed.

EMBs are not designed to display huge walls of text - and given the known limitations of @TAB use - certainly not when the @TABs form the majority of the text. If the elements of the data to be displayed are always of the relatively small size shown above I would strongly suggest using a ListView (as I suggested in the thread when you first mentioned the requirement) as you can then define the column width more closely. In fact using my StringSize UDF (the same as is used internally by EMB) on each element would allow you to create a custom sized dialog very easily (it is basically what is done inside _ArrayDisplay). If you were to start a new thread we could work together to produce something suitable for you - perhaps along these lines:

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

; Original array
Global $aElements[17][13]
For $i = 0 To 16
    For $j = 0 To 12
        $aElements[$i][$j] = "Data" & $i & " - " & $j
    Next
Next

; Define required ListView size and titles
$iRows = 12
$iCols = 8

; Array to display - element contents show which element of data array to display
Global $aDisplay[$iRows][$iCols] = [["Hauteur", "", "", "", "Barbe", "", "", ""], _
                                    ["6-4",  "6-5",      "",     "",  "6-9",  "6-10",      "",      ""], _
                                    ["7-4",   "7-5",     "",     "",  "7-9",  "7-10",      "",      ""], _
                                    ["8-4",   "8-5",  "8-6",  "8-7",  "8-9",  "8-10",  "8-11",  "8-12"], _
                                    ["9-4",   "9-5",  "9-6",  "9-7",  "9-9",  "9-10",  "9-11",  "9-12"], _
                                    ["10-4", "10-5", "10-6", "10-7", "10-9", "10-10", "10-11", "10-12"], _
                                    ["11-4", "11-5", "11-6", "11-7", "11-9", "11-10", "11-11", "11-12"], _
                                    ["12-4", "12-5", "12-6", "12-7", "12-9", "12-10", "12-11", "12-12"], _
                                    ["13-4", "13-5", "13-6", "13-7", "13-9", "13-10", "13-11", "13-12"], _
                                    ["14-4", "14-5", "14-6", "14-7", "14-9", "14-10", "14-11", "14-12"], _
                                    ["15-4", "15-5", "15-6", "15-7", "15-9", "15-10", "15-11", "15-12"], _
                                    ["16-4", "16-5", "16-6", "16-7", "16-9", "16-10", "16-11", "16-12"]]

; Fill display array
For $i = 0 To $iRows - 1
    For $j = 0 To $iCols - 1
        $aSplit = StringSplit($aDisplay[$i][$j], "-")
        If Not @error Then
            $aDisplay[$i][$j] = $aElements[$aSplit[1]][$aSplit[2]]
        EndIf
    Next
Next

; Define button size
$iButton_Width = 80
$iButton_Height = 30

; Now create a GUI
$hGUI = GUICreate("", 500, 500)

; Create ListView
Local $cListView = GUICtrlCreateListView("", 10, 10, 480, 450, BitOr($LVS_SHOWSELALWAYS, $LVS_NOCOLUMNHEADER))
_GUICtrlListView_SetExtendedListViewStyle($cListView, BitOr($LVS_EX_FULLROWSELECT, $WS_EX_CLIENTEDGE))
For $i = 0 To 7
    _GUICtrlListView_AddColumn($cListView, "", 100)
Next

; Fill ListView
_GUICtrlListView_BeginUpdate($cListView)
_GUICtrlListView_AddArray($cListView, $aDisplay)
_GUICtrlListView_EndUpdate($cListView)

; Determine required ListView size
$iLV_Width = 0
For $i = 0 To $iCols - 1
    _GUICtrlListView_SetColumnWidth($cListView, $i, $LVSCW_AUTOSIZE)
    $iLV_Width += _GUICtrlListView_GetColumnWidth($cListView, $i) + 5
Next
$hHeader = _GUICtrlListView_GetHeader($cListView)
$aHdrPos = WinGetPos($hHeader)
$aRect = _GUICtrlListView_GetItemRect($cListView, 0)
$iLV_Height = $aHdrPos[3] + (($aRect[3] - $aRect[1] + 1) * $iRows)

; Resize GUI and ListView
GUISetState(@SW_HIDE, $hGUI) ; Must display before changing size
WinMove($hGUI, "", Default, Default, $iLV_Width + 20, $iLV_Height + 60 + $iButton_Height)
WinMove(GUICtrlGetHandle($cListView), "", 10, 10, $iLV_Width, $iLV_Height)

; Create buttons using a simple algorithm to correctly place them
$cButton_1 = GUICtrlCreateButton("One", (($iLV_Width + 20) / 2) - $iButton_Width - 10, $iLV_Height + 20, 80, 30)
$cButton_2 = GUICtrlCreateButton("Two", (($iLV_Width + 20) / 2) + 10, $iLV_Height + 20, 80, 30)

GUISetState(@SW_SHOW, $hGUI)

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

M23

Edited by Melba23
Added code

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

 

Posted

Well, that's a lesson in ListView() for me :)  I've attempted to unravel it before - unsuccessfully.  Time constraints.

Your example certainly can do the job but it will have to wait a while - flights booked to China.  They will have to suffer MsgBox() for now.

I shall return. Thank you.

The most powerful number in the Universe.  Zero.

  • 4 months later...
Posted (edited)

So close, so close, but I ran into a couple issue that have been driving me nuts on the odd project.

  1. The Space handling you do seems to break windows standards, in the normal course of events, if a button has the focus and you press space it activates that button, in your dialog, if you set the first button as the default then use tab to switch to the second button and then press space you still get a return code of one which is wrong and very dangerous.
  2. An addition to that item is the fact that you have to press the tab once to GET to the default button, the first press of the tab only goes to the first button (even if that is the default) then you have to press it again to get the next button.   Should the default button not have the focus when the dialog is opened?
  3. Why on earth did you break standard shortcut key handling by re-purposing the & (which has been a windows standard since the late '80s, even VBDos used it) (Stick an ampersand in the caption and instant keyboard shortcut, I use it in autoit all the time)
  4. Am I missing something or should it not vertically center a single line of text with the icon (or maybe it's the icon that should be moving), in all my tests the latest version didn't, but I had thought an older version did?
Edited by xrxca
By far, the worst four letter word (swear word) out there has to be USER

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...