Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2015-10

lazcontrols filters

25 messages · 7 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Andrea Mauri

Dear all,

I didn't find a way to change the grey text "(filter)" that appears in TListFilterEdit controls and similar.

I think it could be useful to have a property storing that text in order to be able to personalize it. It's quite common to put a tip to what can be written in that box, something like "Find something..."

I missed it?

Regards,
Andrea Mauri

Reply by email

Péter Gábor
to Andrea Mauri

Hi!

Use can use TListFilterEdit.TextHint if you uye the developer version. Unfortunately .TextHint does not appear in the Object Inspector yet.

2015-10-05 14:06 keltez?ssel, Andrea Mauri ?rta:

Show quoted text 10 lines
I didn't find a way to change the grey text "(filter)" that appears in TListFilterEdit controls and similar. I think it could be useful to have a property storing that text in order to be able to personalize it. It's quite common to put a tip to what can be written in that box, something like "Find something..." I missed it? Regards, Andrea Mauri
P?ter G?bor

Reply by email

Andrea Mauri
to Péter Gábor

I am using lazarus svn fixes_1_4, no texthint here. Is TextHint in trunk?

Andrea

Il 05/10/2015 16:18, P?ter G?bor ha scritto:

Show quoted text 16 lines
Hi! Use can use TListFilterEdit.TextHint if you uye the developer version. Unfortunately .TextHint does not appear in the Object Inspector yet. 2015-10-05 14:06 keltez?ssel, Andrea Mauri ?rta: > I didn't find a way to change the grey text "(filter)" that appears in > TListFilterEdit controls and similar. > I think it could be useful to have a property storing that text in order > to be able to personalize it. It's quite common to put a tip to what can > be written in that box, something like "Find something..." > > I missed it? > > Regards, > Andrea Mauri

Reply by email

Péter Gábor
to Andrea Mauri

I'm using Lazarus 1.5 from trunk (r49937).
Trunk has TextHint since a while...
I hope that the developers will change the classes to allow access of .TextHint in the Object Inspector.

2015-10-05 18:09 keltez?ssel, Andrea Mauri ?rta:

Show quoted text 32 lines
I am using lazarus svn fixes_1_4, no texthint here. Is TextHint in trunk? Andrea Il 05/10/2015 16:18, P?ter G?bor ha scritto: > Hi! > > Use can use TListFilterEdit.TextHint if you uye the developer version. > Unfortunately .TextHint does not appear in the Object Inspector yet. > > 2015-10-05 14:06 keltez?ssel, Andrea Mauri ?rta: >> I didn't find a way to change the grey text "(filter)" that appears in >> TListFilterEdit controls and similar. >> I think it could be useful to have a property storing that text in order >> to be able to personalize it. It's quite common to put a tip to what can >> be written in that box, something like "Find something..." >> >> I missed it? >> >> Regards, >> Andrea Mauri -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
P?ter G?bor

Reply by email

Bart
to Péter Gábor
P?ter G?bor wrote
Trunk has TextHint since a while... I hope that the developers will change the classes to allow access of .TextHint in the Object Inspector.

Please post patches (in bugtracker) for controls (TCustomEdit descendants or compound controls that have a TCustomEdit in it) that do not pubish these properties.
They can be assigned to me.

Bart

Reply by email

Péter Gábor
to Bart: Please post patches (in bugtracker) for controls (TCustomEdit descendants or compound…

What do you think about moving TextHint related things from TCustomEdit to TWinControl to make TextHint available for all TWinControl descendants, for example TComboBox.
In this case developers may have unified look of controls on a single form. Anyway TextHint for ComboBoxes would be welcome.

2015-10-05 18:40 keltez?ssel, Bart ?rta:

Please post patches (in bugtracker) for controls (TCustomEdit descendants or compound controls that have a TCustomEdit in it) that do not pubish these properties.
P?ter G?bor

Reply by email

Bart
to Péter Gábor
P?ter G?bor wrote
What do you think about moving TextHint related things from TCustomEdit to TWinControl to make TextHint available for all TWinControl descendants, for example TComboBox.

It would be Delphi incompatible.
AFAIK TextHint is introduced in TCustomEdit there.

Bart

Reply by email

Péter Gábor
to Bart

Would it be a serious incompatibility that can break compilation of project sources? (I never used delphi)

Do you think that a new ComboBox implementation (based on TComboBox) with copy-pasted TextHint support can be a good solution? ...or it would be better to forget this.

2015-10-07 20:30 keltez?ssel, Bart ?rta:

It would be Delphi incompatible. AFAIK TextHint is introduced in TCustomEdit there.
P?ter G?bor

Reply by email

Juha Manninen
to Péter Gábor: What do you think about moving TextHint related things from TCustomEdit to TWinControl to…
P?ter G?bor wrote
What do you think about moving TextHint related things from TCustomEdit to TWinControl to make TextHint available for all TWinControl descendants, for example TComboBox.

I don't think it makes sense for all TWinControl derivatives.

In this case developers may have unified look of controls on a single form. Anyway TextHint for ComboBoxes would be welcome.

For TComboBox it would make sense.
It would be an extension and thus not break Delphi compatibility either. I think it is a good idea.

Juha

Reply by email

Bart
to Juha Manninen
Juha Manninen wrote 6 lines
I don't think it makes sense for all TWinControl derivatives. For TComboBox it would make sense. It would be an extension and thus not break Delphi compatibility either. I think it is a good idea.

This is rather more tricky than what we did for TCustomEdit. Mind you that Delphi has it easy,it simply calls some Windows API to get this done, but we need to implement this cross-platform (hence we override RealSetText and RealGetText).
Setting Text in a ComboBox may have other side effects then in a TCustomEdit.

Bart

Reply by email

Juha Manninen
to Bart
Bart wrote 5 lines
This is rather more tricky than what we did for TCustomEdit. Mind you that Delphi has it easy,it simply calls some Windows API to get this done, but we need to implement this cross-platform (hence we override RealSetText and RealGetText). Setting Text in a ComboBox may have other side effects then in a TCustomEdit.

Ok, I don't know the details well.

Juha

Reply by email

Ondrej Pokorny
to Juha Manninen
Juha Manninen wrote 7 lines
On Thu, Oct 8, 2015 at 7:22 PM, Bart wrote: > This is rather more tricky than what we did for TCustomEdit. > Mind you that Delphi has it easy,it simply calls some Windows API to > get this done, but we need to implement this cross-platform (hence we > override RealSetText and RealGetText). > Setting Text in a ComboBox may have other side effects then in a TCustomEdit. Ok, I don't know the details well.

Isn't is possible to paint the TextHint text manually into the combobox / edit?

Ondrej

Reply by email

Bart
to Ondrej Pokorny
Ondrej Pokorny wrote
Isn't is possible to paint the TextHint text manually into the combobox / edit?

At least TCustomEdit does not have a canvas, so that won't work (would have been so much easier than the current implementation). Does TComboBox have a canvas?

Bart

Reply by email

Ondrej Pokorny
to Bart
Bart wrote 7 lines
On 10/8/15, Ondrej Pokorny wrote: > Isn't is possible to paint the TextHint text manually into the combobox > / edit? At least TCustomEdit does not have a canvas, so that won't work (would have been so much easier than the current implementation). Does TComboBox have a canvas?

TComboBox must have a canvas because it supports OwnerDrawing.

Ondrej

Reply by email

Bart
to Ondrej Pokorny
Ondrej Pokorny wrote
TComboBox must have a canvas because it supports OwnerDrawing.

You're right.
And if OwnerDrawing is False then everything you write tothe cnavs gets erased whenever the control paints itself.
So, maybe not the way to go.

Bart

Reply by email

Ondrej Pokorny
to Bart
Bart wrote
You're right. And if OwnerDrawing is False then everything you write tothe cnavs gets erased whenever the control paints itself. So, maybe not the way to go.

True.

I was able to paint custom shapes on TEdit on Windows with this approach:
http://stackoverflow.com/questions/9758016/how-do-i-custom-draw-of-tedit-control-text . It works well.

But it fails on Linux/Gtk2. The edit control is always painted after my paint procedure, overpainting everything except a tiny space between bounds and the edit.

But if we assume that it is possible in TComboBox with OwnerDraw, there must be a way how to do it even on Gtk2. Or is OwnerDraw linked with some Gtk2-ComboBox property?

Ondrej

Reply by email

Bart
to Ondrej Pokorny
Ondrej Pokorny wrote
But if we assume that it is possible in TComboBox with OwnerDraw, there must be a way how to do it even on Gtk2. Or is OwnerDraw linked with some Gtk2-ComboBox property?

It may be possible, but TextHint vailability cannot depend on OwnerDraw.

Bart

Reply by email

Ondrej Pokorny
to Krzysztof
Krzysztof wrote
TextHint could be visibile even when edit is focused (but still empty of course). This is how many edit controls work nowadays, e.g address edit in FireFox

This is exactly what I was thinking. The rekonq browser has the same. It is even able to put a button in front of the text in the edit and start the text after the edit + the hint text is centered. I admit that I don't know if rekonq uses Qt or Gtk2.

Whereas I know how to achieve it on Windows (one can find a lot of sources for it in the internet), on other widgetsets it could be tricky as Bart already stated. Unfortunately I don't have the knowledge to do it in all widgetsets :(

Ondrej
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rekonq.png
Type: image/png
Size: 44402 bytes
Desc: not available
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20151010/8528eb4c/attachment-0001.png>

Reply by email

Juha Manninen
to Ondrej Pokorny
Ondrej Pokorny wrote
This is exactly what I was thinking. The rekonq browser has the same. It is even able to put a button in front of the text in the edit and start the text after the edit + the hint text is centered. I admit that I don't know if rekonq uses Qt or Gtk2.

Rekonq uses both QT and KDE libs. Not directly usable for LCL implementation but a nice idea anyway.

Juha

Reply by email

Ondrej Pokorny
to Juha Manninen
Juha Manninen wrote
Rekonq uses both QT and KDE libs. Not directly usable for LCL implementation but a nice idea anyway.

It was not exactly an idea to implement it in the LCL but more an argument that it is possible to do advanced stuff (custom painting, text area moving etc.) even on Linux and not only on Windows.

So that means that it is possible to custom paint an edit at least on Qt. It is another problem that we (me definitely) don't know how to do it.

Rekonq source is available on the internet
https://projects.kde.org/projects/extragear/network/rekonq/repository so somebody with Qt knowledge could check how they do it and if it is possible to use a similar approach in the LCL.

The fact that TextHint uses the "normal" Text property in TEdit sounds more a hack to me. Such custom painting could be safely used for TComboBox as well.

Safari is able to do the same on OSX, so I assume that custom painting is available on every widgetset.

Ondrej

Reply by email

zeljko
to Ondrej Pokorny: This is exactly what I was thinking. The rekonq browser has the same. It is even able to…
Ondrej Pokorny wrote
This is exactly what I was thinking. The rekonq browser has the same. It is even able to put a button in front of the text in the edit and start the text after the edit + the hint text is centered. I admit that I don't know if rekonq uses Qt or Gtk2.

That's because rekonq uses kdelibs which have their own implementation of QLineEdit.

zeljko

Reply by email

zeljko
to Ondrej Pokorny: It was not exactly an idea to implement it in the LCL but more an argument that it is…
Ondrej Pokorny wrote 10 lines
On 10.10.2015 18:47, Juha Manninen wrote: > Rekonq uses both QT and KDE libs. Not directly usable for LCL > implementation but a nice idea anyway. It was not exactly an idea to implement it in the LCL but more an argument that it is possible to do advanced stuff (custom painting, text area moving etc.) even on Linux and not only on Windows. So that means that it is possible to custom paint an edit at least on Qt. It is another problem that we (me definitely) don't know how to do it.

Yes, it's possible to achieve that goal with Qt. In event filter of TQtLineEdit add QPaintEvent, and:
1.Paint QLineEdit by Qt - use QObject_event(Widget, Event); 2.Now call SlotPaint() which creates TQtDeviceContext and passes it to LCL ... if TEdit have Canvas and OnPaint you can do whatever in that case. 3.Now set Result := True in QPaintEvent, so Qt won't paint it again.

zeljko

Reply by email

Bart
to Ondrej Pokorny: It was not exactly an idea to implement it in the LCL but more an argument that it is…
Ondrej Pokorny wrote
The fact that TextHint uses the "normal" Text property in TEdit sounds more a hack to me. Such custom painting could be safely used for TComboBox as well.

Yes it is.
We did it that way because not all widgetsets natively support such a feature (or at least we were not aware of this).
And we were not willing to make TCustomEdit "custom painted".

TextHint is natively supported on Windows (and most likely on WinCE) via a system API.
If (and only if) this can be achieved via all other widgetsets (QT, GTK2, Carbon, Cocoa) the hack can be removed and the code can be moved to the widgetset implementation.

So, does anybody know wether the other widgetsets offer this functionalitly natively?

Bart

Reply by email