Jump to content

StringSize - M23 - BugFix version 27 Dec 23


Melba23
 Share

Recommended Posts

Hi Melba ;)

I tried the script below and it worked well , the weird thing is that It didn't work for the labels , and to confuse me more : when I changed the last parameter (label size) to "400" instead of "200" it worked fine !

so I guess I will work with the 400 till I know where I made things wrong

Link to comment
Share on other sites

  • 4 months later...

I'm curious.

Has anyone really been far even as decided to use even go want to do look more like?

I mean, has anyone ever tried making a customized tool tip script from this?

I'd imagine that this would be great for making an awesome little tooltip UDF with GDIPlus

allowing a user to create custom colored tooltips with fade in and fade out abilities.

I'd try doing it but GDI and math isn't my strong side :P

Link to comment
Share on other sites

  • 4 months later...

Ok, first, Melba, I <3 you and your knowledge of Autoit, and your UDFs. I use several and they're great, so is this one.

Onto my problem.

I'm trying to create a chat, (and using your GUIFrame UDF :P) and I want the edit box you type into, to grow to two lines if you write longer than the width.

So, if your you text is longer than say 100px, change the input from 20px height, to 40px. Then back down to 20px when you're at less than 100px length message.

The problem I'm having, is that my GUI is re-sizable so it's possible to have the input box very small, and not long enough to fit a full word (or random non-sense), which makes _StringSize return error 3.

I guess what I'm trying to ask, is if there's a way, when it reaches the max width you set, to insert a line break, or space there, instead of returning an error? Or maybe just a work around for my script. Anyway, here's some code that shows what I'm taking about.

#include-once
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <GuiConstants.au3>
#include <WinAPI.au3>
#include "StringSize.au3"

Global $GUIMINWID = 300, $GUIMINHT = 100
Global $GUIMAXWID = @DesktopWidth, $GUIMAXHT = @DesktopHeight
Global $Lines = 1

GUIRegisterMsg($WM_GETMINMAXINFO, "WM_GETMINMAXINFO")

$hGUI = GUICreate("Test", 500, 300, -1, -1, BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_SIZEBOX))
GUISetState()

$History = GUICtrlCreateEdit('RAWRAWRAWRAWR' & @CRLF & 'asdfasdfasdf', 2, 2, 293, 255, 2103360 + $ES_MULTILINE)
GUICtrlSetResizing(-1, 103)
$Input = GUICtrlCreateEdit('', 2, 270, 270, 20, BitOR($ES_AUTOVSCROLL, $ES_WANTRETURN, $WS_BORDER), 0)
GUICtrlSetFont(-1, 10, 400, 0, "Courier New")
GUICtrlSetResizing(-1, 582)

While 1
Sleep(10)
If ControlGetFocus($hGUI, 'Edit2') And GUICtrlRead($Input) <> '' Then
$ciPos = ControlGetPos($hGUI, '', 'Edit2')
$chPos = ControlGetPos($hGUI, '', 'Edit1')
$iText = GUICtrlRead($Input)
$iLen = _StringSize($iText, 10, Default, Default, "Courier New", $ciPos[2])
If @error Then
MsgBox(0, '', 'Error: ' & @error)
Exit
EndIf
If $iLen[3] > 20 And $Lines = 1 Then
GUICtrlSetPos($History, $chPos[0], $chPos[1], $chPos[2], $chPos[3] - 20)
GUICtrlSetPos($Input, $ciPos[0], $ciPos[1] - 20, $ciPos[2], $ciPos[3] + 20)
$Lines += 1
ElseIf $iLen[3] = 20 And $Lines > 1 Or $iText = '' Then
$Lines = 1
GUICtrlSetPos($History, $chPos[0], $chPos[1], $chPos[2], $chPos[3] + 20)
GUICtrlSetPos($Input, $ciPos[0], $ciPos[1] + 20, $ciPos[2], 20)
EndIf
EndIf
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
Exit

EndSwitch
WEnd

Func WM_GETMINMAXINFO($hwnd, $Msg, $wParam, $lParam)
$tagMaxinfo = DllStructCreate("int;int;int;int;int;int;int;int;int;int", $lParam)
DllStructSetData($tagMaxinfo, 7, $GUIMINWID) ; min X
DllStructSetData($tagMaxinfo, 8, $GUIMINHT) ; min Y
DllStructSetData($tagMaxinfo, 9, $GUIMAXWID); max X
DllStructSetData($tagMaxinfo, 10, $GUIMAXHT) ; max Y
Return 0
EndFunc ;==>WM_GETMINMAXINFO
Exit

Also, why no tabs? :(

We ought not to misbehave, but we should look as though we could.

Link to comment
Share on other sites

  • Moderators

mistersquirrle,

Thanks for the compliments. :>

I am thinking about the problem. But I am not confident of finding a solution as the behaviour for which you are asking is fundamentally flawed in my opinion - how do you determine later which spaces/line breaks are intentional and which were merely inserted to get the text to fit in an arbitrarily sized control? :huh:

As to "why no tabs", I do not understand the question. If you are asking why does the UDF not take account of tabs, then post #34 in this thread explains and shows how the UDF has been modifed to do so. If you are asking why you cannot insert a tab into an edit/input control, then that is a Windows (not AutoIt) limitation and can be overcome by using "Ctrl-TAB". :)

M23

Edit: Perhaps something like this might be a better way to approach the problem - let Windows do the line breaks and we will just adjust the size of the controls to match. A rough idea of what I mean: :)

#include-once
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <GuiConstants.au3>
#include <WinAPI.au3>

#include <GuiEdit.au3>

Global $GUIMINWID = 300, $GUIMINHT = 100
Global $GUIMAXWID = @DesktopWidth, $GUIMAXHT = @DesktopHeight
Global $Lines = 1

GUIRegisterMsg($WM_GETMINMAXINFO, "WM_GETMINMAXINFO")

$hGUI = GUICreate("Test", 500, 300, -1, -1, BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_SIZEBOX))
GUISetState()

$History = GUICtrlCreateEdit('RAWRAWRAWRAWR' & @CRLF & 'asdfasdfasdf', 2, 2, 293, 225, 2103360 + $ES_MULTILINE)
GUICtrlSetResizing(-1, 103)
$Input = GUICtrlCreateEdit('', 2, 260, 270, 20, BitOR($ES_AUTOVSCROLL, $ES_WANTRETURN, $WS_BORDER, $ES_MULTILINE), 0)
GUICtrlSetFont(-1, 10, 400, 0, "Courier New")
GUICtrlSetResizing(-1, 582)

$iLines = 1

While 1

    $iLine_Count = _GUICtrlEdit_GetLineCount($Input)
    If $iLine_Count <> $iLines Then
        $iLines = $iLine_Count
        ConsoleWrite($iLines & @CRLF)
        $aHistoryPos = ControlGetPos($hGUI, "", $History)
        GUICtrlSetPos($History, $aHistoryPos[0], $aHistoryPos[1], $aHistoryPos[2], $aHistoryPos[3] - 20)
        $aInputPos = ControlGetPos($hGUI, "", $Input)
        GUICtrlSetPos($Input, $aInputPos[0], $aInputPos[1] - 20, $aInputPos[2], $iLines * 20)
    EndIf

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

Func WM_GETMINMAXINFO($hwnd, $Msg, $wParam, $lParam)
    $tagMaxinfo = DllStructCreate("int;int;int;int;int;int;int;int;int;int", $lParam)
    DllStructSetData($tagMaxinfo, 7, $GUIMINWID) ; min X
    DllStructSetData($tagMaxinfo, 8, $GUIMINHT) ; min Y
    DllStructSetData($tagMaxinfo, 9, $GUIMAXWID); max X
    DllStructSetData($tagMaxinfo, 10, $GUIMAXHT) ; max Y
    Return 0
EndFunc   ;==>WM_GETMINMAXINFO
Exit

If you want to follow this line than let me know and I will split these posts into a new thread as we have drifted away from the UDF. ;)

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

 

Link to comment
Share on other sites

Huh, yeah, that is probably a much better way to do it... I haven't really looked into the GUI UDFs, since there are so many.

That certainly worked, and I was actually thinking of something very similar to that, which made me remember my post and come back to check. Right now, I'm trying to get the TCP to work for my chat, and I want to focus on that before I go and dink around with putting your solution in, but it does seem much more elegant.

I also wasn't thinking too clearly when I asked my question about just putting in a space, because yeah, obviously, how would you tell the difference between the inserted ones, and normal ones? That's why I come here, to ask greater minds to think about my stupid questions :P

My 'no tabs' part was to the code that I posted in my post, they all got eaten :(

We ought not to misbehave, but we should look as though we could.

Link to comment
Share on other sites

  • Moderators

mistersquirrle,

So do I take it you would like to explore my idea further? Just let me know and I will split this into a new thread and remove any posts like this one. :)

As to the forum editor eating the tabs, you need to be in basic mode to keep them. Nothing we can do - other than hope IPB improve the editor in the next version. ;)

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

Yeah, looking at what you did, I should be able to do what I want with it. If you want to, you can split this into another topic. If I need help manipulating your code to my ends, I can also always just make a new thread myself. So no worries.

Delete this or whatever post you want.

Thank you :)

We ought not to misbehave, but we should look as though we could.

Link to comment
Share on other sites

  • 8 months later...

Hi Melba, i need your help :D

This is my script:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#include <StringSize.au3>

 HotKeySet("{Esc}", "_EXIT")

$iFontName = "Arial"
$iFontSize = 25
$aSize = _StringSize("MYTEXT", $iFontSize, Default, Default, $iFontName, 0)

$hGUI = GUICreate("Test", $aSize[2], $aSize[3], -1, -1, $WS_POPUP)
$fLabel = GUICtrlCreateLabel($aSize[0], 0, 0, $aSize[2], $aSize[3], BitOR($SS_CENTER, $SS_CENTERIMAGE))
GUICtrlSetFont(-1, $iFontSize, 400, 0, $iFontName)
GUICtrlSetColor(-1, "0xFFFFFF")
GUICtrlSetBkColor(-1, "0x000000")
GUISetState(@SW_SHOW)

While 1
    Sleep(100)
WEnd

Func _EXIT()
    Exit
EndFunc

And this is the result:

11gr1nr.jpg

Now i what to add another label like this image ( is a painted version, not perfect but give the idea :D )

1j0c5.jpg

So pratically i want to add a label with this feature:

1) Don't change the GUI width size but fit the text inside in

2) Use the same font of the first label but different size always based on the first label

3) Make the gui more bigger in height based on the new label

Any idea how to accomplish this? Thanks :D

Edited by Terenz

Nothing is so strong as gentleness. Nothing is so gentle as real strength

 

Link to comment
Share on other sites

  • Moderators

Terenz,

I would do it like this:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#include <StringSize.au3>

HotKeySet("{ESC}", "On_Exit")

$iFontName = "Arial"
$iFontSize = 25
$aSize_1 = _StringSize("MYTEXT", $iFontSize, Default, Default, $iFontName)

; Keep reducing the text size until the longer piece is only at least as wide the the short one
For $iSmallerFontSize = $iFontSize To 0 Step -0.5
    $aSize_2 = _StringSize("LONGER TEXT BUT FIT IN", $iSmallerFontSize, Default, Default, $iFontName)
    If $aSize_2[2] <= $aSize_1[2] Then ExitLoop
Next

; So now we have the font size required - but we check we did not hit 0 and failed entirely
If $iSmallerFontSize Then

    ; Now create GUI
    $hGUI = GUICreate("Test", $aSize_1[2], $aSize_1[3] +  + $aSize_2[3], -1, -1, $WS_POPUP)
    ; Set default colours for all controls
    GUICtrlSetDefColor(0xFFFFFF)
    GUICtrlSetDefBkColor(0x000000)
    ; We need 2 labels because of the different font sizes
    $cLabel_1 = GUICtrlCreateLabel($aSize_1[0], 0, 0, $aSize_1[2], $aSize_1[3], BitOR($SS_CENTER, $SS_CENTERIMAGE))
    GUICtrlSetFont(-1, $iFontSize, 400, 0, $iFontName)
    ; Use the same width for this label just in case the second result was a bit shorter
    $cLabel_2 = GUICtrlCreateLabel($aSize_2[0], 0, $aSize_1[3], $aSize_1[2], $aSize_2[3], BitOR($SS_CENTER, $SS_CENTERIMAGE))
    GUICtrlSetFont(-1, $iSmallerFontSize, 400, 0, $iFontName)

    GUISetState(@SW_SHOW)

    While 1
        Sleep(100)
    WEnd

EndIf

Func On_Exit()
    Exit
EndFunc   ;==>On_Exit
Please ask if you have any questions. :)

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

  • Moderators

Terenz,

Glad I could help. :)

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

  • 4 months later...

Hi Melba23,

Using your first example below

#include <GUIConstantsEx.au3>

#include "StringSize.au3"
$sText = " I am a very long line and I am not formatted in any way so that I will not fit within the width of the GUI that surrounds me!"
$hGUI = GUICreate("Test", 500, 500)
; A label with no width or height set

GUICtrlCreateLabel($sText, 10, 10)

GUICtrlSetBkColor(-1, 0xFF8080)
; A label with no height set

GUICtrlCreateLabel($sText, 10, 50, 200)

GUICtrlSetBkColor(-1, 0xC0C0FF)
; A label sized by StringSize

$aSize = _StringSize($sText, Default, Default, Default, Default, 200)

GUICtrlCreateLabel($aSize[0], 10, 90, $aSize[2], $aSize[3])

GUICtrlSetBkColor(-1, 0x80FF80)
GUISetState()
While 1

 Switch GUIGetMsg()

  Case $GUI_EVENT_CLOSE

   Exit

 EndSwitch

WEnd

Could you show me how to centre the gui title "test" pls?

Thank you.

Link to comment
Share on other sites

  • Moderators

Cybermax,

I have used this method with some success:

#include <GUIConstantsEx.au3>
#include <WinAPI.au3>
#include "StringSize.au3"

; Find half title width
$sTitle = "Test of centring"
$aSize = _StringSize($sTitle)
$iHalf = Int($aSize[2] / 2)

$hGUI = GUICreate("", 500, 500)

GUISetState()

; Find width of GUI buttons
$iWidth = _WinAPI_GetSystemMetrics(30) ; SM_CXSIZE
; Calculate mid point of available title bar (3 buttons + icon)
$iMiddle = (500 - (4 * $iWidth)) / 2

; Add spaces until midpoint is reached
$sAdd = ""
Do
    $sAdd &= " "
    $aSize = _StringSize($sAdd)
Until $aSize[2] + $iHalf > $iMiddle

; Set GUI title
WinSetTitle($hGUI, "", $sAdd & $sTitle)

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd
It is not perfect, but it is not a bad approximation. please ask if you have any questions. :)

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

Could you show me how to centre the gui title "test" pls?

This (or at least, this approach) is a bad idea, for a number of reasons: Firstly the title bar is not the only place the user sees the title. In tooltips or alt+tab etc. the title will probably be shortened to look blank to the user. For versions of windows where the title is already centered (which is near enough all of them now), this approach will make it off center (fixed by putting the same padding after the title as well, or a simple os check). Also, when the window resizes you'll have to change the window title.

The correct method is not simple though (probably involves drawing the title yourself). Which raises the question, why is centering the title important to you?

Link to comment
Share on other sites

Thanks Melba23.

After countless trial and error, this code below works :idea: , and I can't figure why, any explaination for this? :think:

#include <GUIConstantsEx.au3>
#include <WinAPI.au3>
#include "StringSize.au3"
; Find half title width
$sTitle = "Test of centring"
$aSize = _StringSize($sTitle)
$iHalf = Int($aSize[2] / 2)
$hGUI = GUICreate("", 500, 500,-1,-1,0x00C00000)
GUISetState()
; Find width of GUI buttons
$iWidth = _WinAPI_GetSystemMetrics(29) ; SM_CXSIZE
; Calculate mid point of available title bar (3 buttons + icon)
$iMiddle = (500 - (4 * $iWidth)) / 2
; Add spaces until midpoint is reached
$sAdd = ""
Do
    $sAdd &= " "
    $aSize = _StringSize($sAdd)
Until $aSize[2] + $iHalf > $iMiddle
; Set GUI title
WinSetTitle($hGUI, "", $sAdd & $sTitle)
While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

I'm not sure what you mean by self centered, check os etc,Mat? :blink:

I thought everyone likes perfect alignment including me, unless I'm wrong. >_<

Usually I would use alot of spacing(type in manually) before the title text to made perfect alignment but sometimes it just didnt work out for some windows titles and I'm tired of doing it over and over again(manually spacing the title) everytime.

Edited by CyberMax
Link to comment
Share on other sites

Melba23,

I have a resizable gui with an edit control inserted into a tab (it's for displaying chat which may go over several lines depending on how wide the GUI is at the time).  I was wondering if your stringsize UDF could be used to help me format the chat into columns.  Essentially,  this is what I am looking for (picture tabs in place of spaces):

Time    Username                Line of chat

Time    Longer Username         Line of chat that user types

                                continuation of line of chat

                                even more chat.

Time    Username                Another line of chat

 

Currently, I have the above working in my edit but the chat is formatted for one particular width of edit box.  Unfortunately, if a user resizes the gui, the chat width doesn't change and it begins to look stupid.  I was hoping your stringsize UDF would give me an idea as to how many words I could fit on the rest of the line.

P.S. forgot to mention, edit box has a vertical scroll bar so I need to account for that as well

P.P.S. thought about using _GUICtrlRichEdit which allows coloring and formatting but it doesn't resize in a tab properly using GUICtrlSetResizing

Nevermind, going to use RichEdit as I found an easy way to resize the richedit without a lot of maths (it's surrounded by a group control so I will base resize off that).

Edited by PartyPooper
Link to comment
Share on other sites

  • 1 year later...

M23,

I finally found time to try your StringSize UDF, after your referral a few days ago on a post I made about “Automatic Height issue with GUI Labels and word wrap”. I'm writing to say the function is working perfectly, is incredibly well documented, and was very easy to implement. The only stuff I don’t understand are the DLL Calls (the heart of the function), but that’s my problem, and something I really should learn.

Thanks M23 for sharing your work!

Link to comment
Share on other sites

  • Moderators

ILLBeBack,

Glad you like it.  The DLL calls are actually not that complicated once you look into them - the first set determine the font to be used and then the GetTextExtentPoint32W calls do the actual sizing.

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

  • Melba23 changed the title to StringSize - M23 - BugFix version 27 Dec 23

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

  • Recently Browsing   0 members

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