TRVFontComboBox and Modified

General TRichView support forum. Please post your questions here
Post Reply
standay
Posts: 321
Joined: Fri Jun 18, 2021 3:07 pm

TRVFontComboBox and Modified

Post by standay »

Hi Sergey,

I'm trying to use a TRVFontComboBox and it keeps setting the rve modified flag even when I don't change the font. If I click in it and then out of it, it sets modified. If I drop it down and don't select a new font name it still sets my rve modified.

Is there a way to change that behavior so it only sets modified when I actually change the font name?

Thanks

Stan
Sergey Tkachenko
Site Admin
Posts: 18015
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: TRVFontComboBox and Modified

Post by Sergey Tkachenko »

This change isn't as simple as it seems at first glance.
We need to add checks to ensure that the operation has changed anything in the document. This requires numerous small changes in many places in the code. This will be added in the next update.
standay
Posts: 321
Joined: Fri Jun 18, 2021 3:07 pm

Re: TRVFontComboBox and Modified

Post by standay »

Hi Sergey,

Oh I agree, it's going to be tricky since you have to support it as a component. I'm using a regular combobox again for now. I just used the click method to do an ApplyStyleConversion.

I don't use an action with it to keep it simple. Getting that and my regular combobox for font size were both not as simple to do as I thought they would be. Took a lot of tweaking to get them right.

Thanks Sergey.

Stan
Sergey Tkachenko
Site Admin
Posts: 18015
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: TRVFontComboBox and Modified

Post by Sergey Tkachenko »

The problem is in ApplyStyleConversion, not in the combobox. It calls OnChange even if nothing was changed. This problem is noticeable in TRVFontComboBox because it applies itself when losing focus.
standay
Posts: 321
Joined: Fri Jun 18, 2021 3:07 pm

Re: TRVFontComboBox and Modified

Post by standay »

Sergey Tkachenko wrote: Thu Jan 08, 2026 5:45 pm The problem is in ApplyStyleConversion, not in the combobox. It calls OnChange even if nothing was changed. This problem is noticeable in TRVFontComboBox because it applies itself when losing focus.
Hi Sergey,

In my regular VCL combobox, ApplyStyleConversion works in the combo OnClick without changing my rve modified state when the combobox is clicked or dropped down but no new value is selected. Maybe it's the way I have it implemented but I'm not having any issue with the regular combobox.

Note that the TRVFontSizeComboBox also sets modified if it's just clicked into and then out of or dropped down without actually selecting any new value. Same as the TRVFontComboBox does.

Stan
standay
Posts: 321
Joined: Fri Jun 18, 2021 3:07 pm

Re: TRVFontComboBox and Modified

Post by standay »

Hi Sergey,

Yeah, after messing with my regular combobox code some more I see what you mean with this. It's much more tricky than I thought if you want to keep the modified from firing and to keep auto complete functionality which is useful for the font name combo. I have it working fairly well with a regular combo now but we'll see.

I switched from using onClick to onExit to keep the auto complete working, and I don't run ApplyStyleConversion unless the combo text and current style names don't match.

On my regular combo I use for the font size, I just turned auto complete off and that lets it work more easily.

Well, if you can figure it out that's great. Maybe a DoDefault param in the TCustomRVFontComboBox.DoExit to let the user skip the default processing and add their own in the OnExit?

Stan
Sergey Tkachenko
Site Admin
Posts: 18015
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: TRVFontComboBox and Modified

Post by Sergey Tkachenko »

This problem will be solved by modifying TRichViewEdit.ApplyStyleConversion (and all other Apply* methods).
TRichViewEdit.ApplyStyleConversion will do nothing (and do not call OnChange), if this operation does not modify document.
Post Reply