Jump to content

Recommended Posts

Posted

On my homebox I'm running Win7-64, currently I'm working on a XP-32 machine (might be the reason for the differences!), I'll recheck later in the evening when I'm at home.

If your standard is "Segoe UI, 9" and you get "MS Shell Dlg, 8" from my code, this indicates that it returns an error on Vista. Rerun attached code and look at console for error.

By the way, I always thought that MS Shell Dlg and MS Shell Dlg2 were shorthand for the real font names stored under

They are, but "MS Shell Dlg" is what my function returns, thus I hardcoded it as the error-substitute too... that one might need an @OSType switch?

HKLM\Software\Microsoft\Windows NT\Currentversion\FontSubstitutes - I have MS Sans Serif and Tahoma as the values in my registry.

Exactly the same here on XP.

Are you sure that MsgBoxes use the default GUI font? It does not appear so on my machine and I know I spent considerable time searching for the default MsgBox font location when I first wrote the UDF.

Nope, can't put my finger on it yet... but see these screenshots, a ) your UDF, b ) my alteration and c ) standard msgbox... hell, even my result does not look 100% the same as the standard (font width?)

Does my original _GetDefaultEMBFont function return data from the $tNONCLIENTMETRICS structure or from the @error default for you

Works and returns Tahoma/9 for me (which is definitely not the font of the standard msgbox on this xp installation).

Definitely does not happen for me with either the original or your version. The EMB comes up in the default "whitish" colour all the time.

I'll have to dig into that.

Please do not think I am not being defensive here, I would like to get the bottom of it but it is a bit difficult if I cannot reproduce the problems you are having. :x

Never ever m8 :P, just want to "fix" a possible error (on my side?) in this great function to use it myself :shifty:...

Some minor adjustments (changed ref ctrl from button to label), added some debug consolewrites...

Posted (edited)

After some research...

This RegKey seems to set the default MsgBox() font and fontsize on XP... I guess it's linked to the "Window Theme".

[HKEY_CURRENT_USER\Control Panel\Desktop\WindowMetrics] "MessageFont"

It's neither the "Tahoma/9" detected by your UDF nor my "MS Shell Dlg/8", it's "Tahoma/8" here (with "MS Shell Dlg2" = "Tahoma"?)... *sigh*...

So... googleing around brought me to this:

http://msdn.microsoft.com/en-us/library/aa511282.aspx

"Choose fonts and optimize window layouts based on the UI technology and the target version of Windows" :x ... different OS, different source for default fonts...

But where there is darkness, there is light :P...

"Developers: From code, you can determine the system font properties (including its size) using the GetThemeFont API function. You can determine the system colors using the GetThemeSysColor API function."

http://msdn.microsoft.com/en-us/library/bb759745(VS.85).aspx

Which might be the way to go?

Edit:

And a quick googleing on that keyword:

http://www.google.com/search?q=GetThemeFont+autoit

Shows that someone on the German autoit.de forum has already coded a great start :shifty:...

(to be continued...)

Edited by KaFu
  • 2 weeks later...
Posted

Great UDF, much easier than a custom GUI for every odd messagebox, I have a couple of minor suggestions.

  • The ability to change the message font/size, but leave the buttons the default font.

    I'm using a script that displays a Well UWI and ask the user to confirm the change, and for clarity I specify a larger fixed width font for the UWI which looks rather silly on the buttons.

    (I modified my copy by adding an extra Global var and an option to _ExtMsgBoxSet and changing the GUISetFont call accordingly)

  • Adjust the button size if the button text will not fit (this can be a real problem if the font has been changed)

  • The ability to specify a custom icon (Maybe pass an icon filename/iconid instead of the icon flag# ?)

  • Be a little more forgiving on message text width, One of the messages my script used includes a variable length id with no spaces in it and on occasion is slightly too long and _ExtMsgBox throws an error 5 because the call to _StringSize returned error 4

    I've modified my copy to increase the width in increments of 50 up to a max of 500 if this happens.

    Local $aLabel_Pos = _StringSize($sText, $iEMB_Font_Size, Default, Default, $sEMB_Font_Name, $iMsg_Width_max - 20 - $iIcon_Reduction)
    while ( @error == 4 ) and ( $iMsg_Width_max < 500 )
        $iMsg_Width_max += 50
        $aLabel_Pos = _StringSize($sText, $iEMB_Font_Size, Default, Default, $sEMB_Font_Name, $iMsg_Width_max - 20 - $iIcon_Reduction)
    wend
    if @error then
        $nOldOpt = Opt('GUIOnEventMode', $nOldOpt)
        Return SetError(5, 0, -1)
    endif
    Not the cleanest solution, but it works for me.
By far, the worst four letter word (swear word) out there has to be USER
  • Moderators
Posted (edited)

xrxca,

Great UDF [...] I have a couple of minor suggestions

That is the way to get your suggestions listened to! :idiot:

- 1. The ability to change the message font/size, but leave the buttons the default font.

Done - you need to add 4 to the $iStyle parameter in the _ExtMsgBoxSet function - 1 and 2 are already used for TaskBar appearance and TOPMOST.

- 2. Adjust the button size if the button text will not fit.

Not prepared to do this - the EMB size computations would become horrendous. However, I have changed the logic of the overall sizing process: even if the text itself does not require the preset max width of the EMB to display, the EMB will expand to allow buttons to display at the maximum available size that will fit within that preset max width rather the minimum size as was the case. Basically, you get bigger buttons even with short text. :idiot:

- 3. The ability to specify a custom icon.

Done. I have had this in my Toast UDF for ages - I cannot think why it was not in this one. :) Just add the filename of an exe or an icon rather than teh numeric value and it displays.

- 4. Be a little more forgiving on message text width

Done. There is a new variable in the _ExtMsgBox function - $iMsg_Width_abs - which is the absolute max value permitted. As with your code, if you get a StringSize error, the EMB expands up to that absolute value in steps of 10 to try and fit in a long unbroken string.

So 3 out of 4 - and some help towards the fourth. I told you that flattery would get you listened to! :D

M23

Edit: New files in first post. ;)

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

 

Posted

woow .. great jop :)

But when i run script .. this massage came :|

Posted Image

note : autoit setup { lastest verson ) & SciTE4AutoIt3 ( lastest also )

So the Problem from where ?

  • Moderators
Posted

Scan,

Just change the line to read #include "ExtMsgBox.au3". ;)

I had mistakenly included the testing example in the zip - it is now corrected. Thanks for pointing it out. :)

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

The re-emergence of error come's again !!

with this massage ?

Posted Image

I have tried adjustment but undeveloped !!

i have change the line but Without new-happens !!

so u can make me know the problem from where ;)

when i change line same error come in a Another line ?

Best regards :)

Posted

If you've followed the instructions in the first post and downloaded the StringSize.au3 file and placed it in the same folder as the UDF then you can change that line to #include "StringSize.au3" instead of using the "< >".

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Posted (edited)

If you've followed the instructions in the first post and downloaded the StringSize.au3 file and placed it in the same folder as the UDF then you can change that line to #include "StringSize.au3" instead of using the "< >".

thank u very match :)

now it's working .. I forgot that we must call the file StringSize.au3

Until the script works well ;)

But may I ask ?

what's the reason for collecting the files ( aut.3 ) in the same folder |!

Edited by Scan
  • Moderators
Posted

Scan,

what's the reason for collecting the files ( aut.3 ) in the same folder

Because it is the easiest way to make sure new users have the #include files available to run the example. If the #include files are in the same folder as the script they are always visible to it.

But did you know you can set specific folders that AutoIt will search for #include files as well as the standard "C:\Program Files\AutoIt3\Include"? :)

From the Help file:

"There is a special registry value that can be created at "HKEY_CURRENT_USER\Software\AutoIt v3\AutoIt" called "Include". It should be a REG_SZ (string) value. The contents of this value are a semi-colon delimited list of directories that should be searched for files when resolving #include's in addition to the standard locations."

If you have the full SciTE4AutoIt3 editor, you can also set this folder in SciTEConfig - look in the <Tools> menu. :idiot:

So you can put all your downloaded includes into a folder away from "C:Program Files" - and it will not be overwritten when you next update!

All clear? ;)

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

Scan,

Because it is the easiest way to make sure new users have the #include files available to run the example. If the #include files are in the same folder as the script they are always visible to it.

But did you know you can set specific folders that AutoIt will search for #include files as well as the standard "C:\Program Files\AutoIt3\Include"? :)

From the Help file:

"There is a special registry value that can be created at "HKEY_CURRENT_USER\Software\AutoIt v3\AutoIt" called "Include". It should be a REG_SZ (string) value. The contents of this value are a semi-colon delimited list of directories that should be searched for files when resolving #include's in addition to the standard locations."

If you have the full SciTE4AutoIt3 editor, you can also set this folder in SciTEConfig - look in the <Tools> menu. :idiot:

So you can put all your downloaded includes into a folder away from "C:Program Files" - and it will not be overwritten when you next update!

All clear? ;)

M23

clear , clear (K) ..

many thx m23

  • Moderators
Posted

Hi,

NEW VERSION released 8 Feb 11.

Added: Countdown option. Seconds to go is displayed in place of an icon - see Test 3 in the example.

Some minor code changes. As usual, no need to change anything in your current scripts - just use the new option if you need it. :)

New files and zip 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

 

Posted

Nice :). I think the default color needs conversion.

Global $iDef_EMB_BkCol = DllCall("User32.dll", "int", "GetSysColor", "int", 15) ; $COLOR_3DFACE = 15
$iDef_EMB_BkCol = RGB2BGR($iDef_EMB_BkCol[0])
Global $iDef_EMB_Col   = DllCall("User32.dll", "int", "GetSysColor", "int", 8) ; $COLOR_WINDOWTEXT = 8
$iDef_EMB_Col = RGB2BGR($iDef_EMB_Col[0])

Func RGB2BGR($iColor)
    Return BitAND(BitShift(String(Binary($iColor)), 8), 0xFFFFFF)
EndFunc   ;==>RGB2BGR
  • Moderators
Posted (edited)

KaFu,

You obviously have non-symmetric hex default colours then! :idiot: I get the Windows default 0xF0F0F0 and 0x000000 so I see no difference.

Looks like another release later today. Thanks for pointing it out. :)

M23

Edit: Done - first post updated. ;)

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

 

Posted
  • Moderators
Posted (edited)

Deleted uncorrected double post - when will we get the "delete post" function working again?

M23

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

 

  • Moderators
Posted

KaFu,

I take it the new upload works as you expect? :)

M23

Edit: Typnig

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

KaFu,

Good! :)

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

 

  • 2 weeks later...
Posted (edited)

Hi Melba !

Nice Work ! Posted Image

I read your topic for knowing if there is a way to set Font weight, but unsuccesfully...

And The box depth should be adjusted to fit but when i tried :

#include <ExtMsgBox.au3>

$_YoutubeUrl = 'http://www.youtube.com/watch?v=XPBwXKgDTdE'
_ExtMsgBoxSet ( 3, 0, 0xFFFF00, 0xFF0000, 12, "MS Sans Serif" )
$sMsg = $_YoutubeUrl & @CRLF
$sMsg &= "Do you want download it ?"
$iRetValue = _ExtMsgBox ( 128, "Yes|No", "Match !", $sMsg, 10 )
ConsoleWrite ( "$iRetValue : " & $iRetValue & @CRLF )

Nothing happens, i must set fontsize to 9 for get it working...Posted Image

And changing font size and font weight is for me the main interest of your ExtMsgBox !

Edited by wakillon

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

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...