Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » Font changes when editing a cell with an Inline Text Control(Font changes when editing a cell with an Inline Text Control)
Font changes when editing a cell with an Inline Text Control [message #1063207] Wed, 12 June 2013 15:55 Go to next message
desis machino is currently offline desis machinoFriend
Messages: 10
Registered: May 2013
Junior Member
I have created a grid and added a CellStyle configAttribute with my desired font and added it to the configRegistry with a unique cell label (and added it with DisplayMode EDIT, NORMAL, and SELECT). I have also added a CELL_EDITOR attribute with a TextCellEditor using the same cell label.

When I run my test, I see the values in the editable cells with the correct Font. When I select the cell, the value is still seen with the correct font. But as soon as I press a key that changes the text, the Font changes to the default font of the grid. Once I leave the cell, the Font changes back to the desired Font.

Should the Font be changing when the TextCellEditor goes into edit mode? Am I doing something incorrect?

Thanks
Re: Font changes when editing a cell with an Inline Text Control [message #1063208 is a reply to message #1063207] Wed, 12 June 2013 16:00 Go to previous messageGo to next message
Edwin Park is currently offline Edwin ParkFriend
Messages: 124
Registered: July 2009
Senior Member
No, you're not doing anything incorrect. When you're not in edit mode the cell is painted with your custom font. What happens is when you edit a text control is created and placed on top of the cell. The font in that text control is not stylable.

Cheers,
Edwin
Re: Font changes when editing a cell with an Inline Text Control [message #1063212 is a reply to message #1063208] Wed, 12 June 2013 16:23 Go to previous messageGo to next message
desis machino is currently offline desis machinoFriend
Messages: 10
Registered: May 2013
Junior Member
Thanks for the quick response Edwin. I really need this functionality (if possible), so I went ahead and created my own object implementing ICellEditor. This way I thought I could get control of the Text control.

I found doing it this way also produces the same result. I even implemented a VerifyListener on the Text object and when a valid Key is pressed, I tried to change the Font on the Text object to the desired Font.

What happens now is that when I type a valid character in an editable cell, the Font changes briefly to my desired Font and then back to the default font.

I was hoping by implementing an ICellEditor and controlling the Text object I could achieve what I wanted. Is this possible? If not, do you know if it possible to change the default font so that I can modify the Font Text object will display when in edit mode?
--------------------------
Just to update, in my own ICellEditor class, I had the some code as the TextCellEditor. I then modified my implementation by removing the code in the keyReleased KeyListener method. What I found is that, if the getCanonicalValue method is not called, the Font does not change. Of course I lose the validation that occurs by removing this logic. Not sure if this was intentional or a misuse on my part.

Thanks again.

[Updated on: Wed, 12 June 2013 16:38]

Report message to a moderator

Re: Font changes when editing a cell with an Inline Text Control [message #1063245 is a reply to message #1063212] Wed, 12 June 2013 19:40 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
Hi Edwin,

it is not correct that you can't style the font in the Text control. It is possible and we support that.

The issue is related to the RenderErrorHandling that seems to don't store the correct style information for restoring correctly. I created a ticket for this and have a look what's wrong.

https://bugs.eclipse.org/bugs/show_bug.cgi?id=410654

Greez,
Dirk
Re: Font changes when editing a cell with an Inline Text Control [message #1063258 is a reply to message #1063245] Wed, 12 June 2013 20:45 Go to previous message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
Fixed! If you update to the current SNAPSHOT build you should see the font rendering in the Text control working correctly.
Previous Topic:Nattable creation in IWorkbenchSiteProgressService
Next Topic:Contribution in Nattable Builder ?
Goto Forum:
  


Current Time: Thu Mar 28 23:13:22 GMT 2024

Powered by FUDForum. Page generated in 0.02138 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top