qlabel - displayed text spaces are shrinked in one space

913 views
Skip to first unread message

Zoran Sibinovic

unread,
Apr 7, 2013, 3:30:06 PM4/7/13
to qtcon...@googlegroups.com
HI,

Two questrions.

By using QLabel

oLabel1:SetText( "Text:   Fox     is on      the              run.")
you got displayed:    "Text: Fox is on the run." 

All the spaces between words are shrinked to one space per word.
Any method to ovecome this?

The second question is about the most similar replacement in HBQT of the DispOutAt() function.

Thanks 

Zoran


 

Francesco Perillo

unread,
Apr 7, 2013, 4:02:11 PM4/7/13
to qtcontribs
QLabel supports text mode and html mode. In html multiple spaces are reduced to one space.

You can't have a DispOutAt equivalence, in GUI mode you need to have objects (like QLabel) and give them a value. OR, you can use the space like a canvas and draw the text yourself. It's not difficult but it's not the best way...



Zoran


 

--
You received this message because you are subscribed to the Google Groups "QtContribs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to qtcontribs+...@googlegroups.com.
To post to this group, send email to qtcon...@googlegroups.com.
Visit this group at http://groups.google.com/group/qtcontribs?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Zoran Sibinovic

unread,
Apr 7, 2013, 5:32:26 PM4/7/13
to qtcon...@googlegroups.com
Francesco, thanks for the explanation.

I have set oLabel3:SetTextFormat( 0 ) and the text keeps the spaces, but lost the color of the text.
Also tried some Qstatusbar() variations, but still the same problem to set the color.

Is it possible to change the text color in the above situations?

Thanks 
Zoran

Francesco Perillo

unread,
Apr 7, 2013, 5:58:23 PM4/7/13
to qtcon...@googlegroups.com

Revert text format and use html   to display a space.
Otherwise change color using the palette, easy but better use html

--

Zoran Sibinovic

unread,
Apr 8, 2013, 2:32:06 AM4/8/13
to qtcon...@googlegroups.com
Hi Francesco,

I set it to 

Label2:SetText( "< font color='Blue' size=4 >"+STRTRAN( "Text:   Fox     is on      the              run." ," ","&nbsp;")+"</font>" )

and the result is okay. Seems the easiest way and keeps the rich text format.

Thanks
Zoran

Pritpal Bedi

unread,
Apr 8, 2013, 4:48:21 PM4/8/13
to qtcon...@googlegroups.com
Zoran


The second question is about the most similar replacement in HBQT of the DispOutAt() function.


In some form DispOutAt() can be implemented, but it will go tricky at times.

DispOutAt() is a GT specific call where SURFACE of the GT is ONE only, let us call it the CONTEXT of display call.
In GUI there could be multiple windows, then which one will be the CONTEXT of such call ? Even if we try, then this is 
not known at what time to destroy such label. Normally, we simply can issue again DispOutAt() on the same coordinates
which cleans the GT SURFACE and redras the buffer onto same coordinates.

At the maximum, what we can think of is like:
DispOutAt( 10,12, cText, cColor, oParent ) and make it happen from within a GET WHEN or VALID calls.
Even that seems insufficient as to when it has to be destroyed. Also Clipper code will have to be modified 
to pass another parameter.

If someone has an idea how it could be achieved in a transaparent manner, please speak-out.


Pritpal Bedi
Reply all
Reply to author
Forward
0 new messages