Long strings with space in TXT

Started by Peter2, August 19, 2013, 05:05:09 AM

Previous topic - Next topic

Peter2

I have a TXT, justification right, and a long string (Path) with spaces.

Problem:
The dialogue displays only the first part  of the string, until the space: "H:\Eigene"

Example from Textscreen ("Befehl" = "Command"):
Code (autolisp) Select

OpenDCL Laufzeitumgebung [7.0.0.12] wurde geladen

Befehl: (dcl_control_getproperty attrib_fill_dialog_txtsteuerdatei1 "Caption")
"H:\\Eigene
Dateien\\Vorlagen_CAD\\Plankopf_Langenthal\\Plankopf_DWG-Neu_GLP.ini"

Befehl: (setq x (dcl_control_getproperty attrib_fill_dialog_txtsteuerdatei1
"Caption"))
"H:\\Eigene
Dateien\\Vorlagen_CAD\\Plankopf_Langenthal\\Plankopf_DWG-Neu_GLP.ini"

Befehl: (type x)
STR

Befehl: (dcl_control_setproperty attrib_fill_dialog_txtsteuerdatei1 "Caption" x)
T

Befehl: (dcl_control_setproperty attrib_fill_dialog_txtsteuerdatei1 "Caption"
"das ist ein text")
T

Befehl: (dcl_control_setproperty attrib_fill_dialog_txtsteuerdatei1 "Caption" x)
T

Befehl: !x
"H:\\Eigene
Dateien\\Vorlagen_CAD\\Plankopf_Langenthal\\Plankopf_DWG-Neu_GLP.ini"


- The space itself is not the problem, because "das ist ein text" works fine.
- The width of the TXT-field is enough to display the string
- Also the value is OK, it works with entire string, but display only a part.

- But you can see it above:
Autocad makes a CR/LF in the space because it is too long for textscreen. Maybe this is the reason?
Peter
ODCL 8.1.... German, AutoCAD 2017 - 2018, Win 7 x64, Win 10

owenwengerd

I assume by "TXT" you mean a Label control. It is normal to wrap text at the nearest space character, and what you describe is normal text wrapping. Therefore, the label is not wide enough to display the caption. Start removing characters from the end of the string until it no longer wraps to demonstrate that the text wrapping is indeed the reason for what you observe.
Owen Wengerd (Outside The Box) / ManuSoft

Peter2

Quote from: owenwengerd on August 19, 2013, 05:24:09 AM
I assume by "TXT" you mean a Label control. ...
Yes. Sorry for the wrong words, but re-translating from German ODCL to English Forum creates some incorrect word..

Quote from: owenwengerd on August 19, 2013, 05:24:09 AM
....It is normal to wrap text at the nearest space character, and what you describe is normal text wrapping. Therefore, the label is not wide enough to display the caption. ....
Yes again.
But what to do when I want no wrapping? "Auto Wrap" and "Label Wrap" are not available for Label controls, and Buttons seem to wrap too...
There will be long string (paths), and usually I used in DCL "right align" to display the important part of the path. The less important beginning of the path disappeared at the left side of the control.
Peter
ODCL 8.1.... German, AutoCAD 2017 - 2018, Win 7 x64, Win 10

owenwengerd

I see what you are trying to achieve. I think your best bet is to shorten the caption programmatically. I believe there is a style bit in Windows for text labels that automatically shortens displayed text by inserting ..., but unfortunately that style bit is not exposed in OpenDCL Label controls. Another option is to use a different control, maybe a Text Box or even something exotic like a Grid, and try to fake it. Maybe someone else has a better idea.
Owen Wengerd (Outside The Box) / ManuSoft

Peter2

Quote from: owenwengerd on August 19, 2013, 08:28:04 AM
...I think your best bet is to shorten the caption programmatically. ...
Hmmmmh. This is possible, but I have to modify my code because "..getProperties.." is used to find a file. When I shorten the string (the path) I have to store the entire string in another value..
Peter
ODCL 8.1.... German, AutoCAD 2017 - 2018, Win 7 x64, Win 10