Jump to content

...


stuka
 Share

Recommended Posts

If you use GUICtrlCreateLabel('', x, y, width, height) and actually put in values for width and height then it the label size by default should not exceed what you put in.

Alternatively, you could use StringLen() for the path you are using and then StringTrimRight() if needed to shorten the string.

My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]
Link to comment
Share on other sites

  • Moderators

SS_WORDELLIPSIS I believe.

Edit:

Global Const $SS_WORDELLIPSIS = 0x00C000
$s_text = "C:/LoooooooonnnnnnngggggFolderName\AnotherLoooooonnnnngFolderName\FileName.jpg"
GUICreate("GUI")
$i_label = GUICtrlCreateLabel($s_text, 10, 10, 180, 20, $SS_WORDELLIPSIS)
GUISetState()
While GUIGetMsg() <> -3
WEnd
Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

SS_WORDELLIPSIS I believe.

Edit:

Global Const $SS_WORDELLIPSIS = 0x00C000
$s_text = "C:/LoooooooonnnnnnngggggFolderName\AnotherLoooooonnnnngFolderName\FileName.jpg"
GUICreate("GUI")
$i_label = GUICtrlCreateLabel($s_text, 10, 10, 180, 20, $SS_WORDELLIPSIS)
GUISetState()
While GUIGetMsg() <> -3
WEnd
Maybe combine that with a hint?

Global Const $SS_WORDELLIPSIS = 0x00C000
$s_text = "C:/LoooooooonnnnnnngggggFolderName\AnotherLoooooonnnnngFolderName\FileName.jpg"
GUICreate("GUI")
$i_label = GUICtrlCreateLabel($s_text, 10, 10, 180, 20, $SS_WORDELLIPSIS)
GUICtrlSetTip(-1,$s_text)
GUISetState()
While GUIGetMsg() <> -3
WEnd
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

  • Moderators

Maybe combine that with a hint?

Global Const $SS_WORDELLIPSIS = 0x00C000
$s_text = "C:/LoooooooonnnnnnngggggFolderName\AnotherLoooooonnnnngFolderName\FileName.jpg"
GUICreate("GUI")
$i_label = GUICtrlCreateLabel($s_text, 10, 10, 180, 20, $SS_WORDELLIPSIS)
GUICtrlSetTip(-1,$s_text)
GUISetState()
While GUIGetMsg() <> -3
WEnd
Very good point/idea.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

  • Moderators

Thanks SmOke_N and martin!

But, I can't seem to find $SS_WORDELLIPSIS in the help file? :(

That's why I provided the global constant value for you in the post :mellow:

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

  • Moderators

Oh wait, it doesn't seem to produce the result I need...

Long label: C:/LoooooooonnnnnnngggggFolderName\AnotherLoooooonnnnngFolderName\FileName.jpg

shortened to...

Shortened Label: C:/Loooooooonnnnnnng\.....\FileName.jpg

Only the middle should be shortened, not the end. It should before the last '\'.

I got this description from the Win32::GUI website:

Any idea?

That's perl... the proper way to do it with windows api (which is what autoit uses) is what I provided. If you need something different, you could spend the rest of the day writing it (probably won't take that long, but you'll have to learn how to get text len in pixel size etc...)

Edit:

Might see if you can get DT_PATH_ELLIPSIS working right.

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

  • Moderators

That's big task for me, a not so experienced coder. But I'll see what I can do. Thank you! :mellow:

Edit:

How does the code below work?

Global Const $SS_WORDELLIPSIS = 0x00C000

P/S: Might be a good style addition to AutoIt :(

The DT_etc I posted got me thinking:
Global Const $SS_PATHELLIPSIS = 0x008000
$s_text = "C:\LoooooooonnnnnnngggggFolderName\AnotherLoooooonnnnngFolderName\FileName.jpg"
GUICreate("GUI")
$i_label = GUICtrlCreateLabel($s_text, 10, 10, 180, 20, $SS_PATHELLIPSIS)
GUICtrlSetTip(-1,$s_text)
GUISetState()
While GUIGetMsg() <> -3
WEnd
I believe that is what you wanted.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Let's say I have a GUI with a width of 200. Then I have this label which has a width of 180. The label length changes according to another variable.

So it is possible for the label length to be longer than the 180 limit. How do I shorten the label length?

For example:

Long label: C:/LoooooooonnnnnnngggggFolderName\AnotherLoooooonnnnngFolderName\FileName.jpg

shortened to...

Shortened Label: C:/Loooooooonnnnnnng\.....\FileName.jpg

Can it be done? And is it possible to tell the script to end the label with the FULL file name(eg. \FileName.jpg)?

Thank you! :mellow:

Check Out: http://www.autoitscript.com/forum/index.ph...st&p=356660 for some ideas.
Link to comment
Share on other sites

Interesting, but SmOke_N and martin's 2 examples seems easier and shorter too. :mellow:

Oppps, didn't see SmOke_N's last post (I opened a browser tab to reply and then didn't do so right away and he snuck in there with the much more elegant answer :( )
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

  • Recently Browsing   0 members

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