Hello all,
Is there a way to set font for a single FXTableItem ? FXTableItem does not
have an appropriate method, there is only a way to set font for the whole
FXTable, globally.
···
–
Best regards,
Yuri Leikind
Hello all,
Is there a way to set font for a single FXTableItem ? FXTableItem does not
have an appropriate method, there is only a way to set font for the whole
FXTable, globally.
–
Best regards,
Yuri Leikind
Yuri Leikind wrote:
Is there a way to set font for a single FXTableItem ? FXTableItem does not
have an appropriate method, there is only a way to set font for the whole
FXTable, globally.
Call FXTableItem.setItem on your subclass of FXTableItem, then twiddle
to your heart’s content in drawContent.
Jim
Perhaps you meant calling FXTable.setItem on my subclass of FXTableItem?
Ok, I define my subclass of FXTableItem with drawContent :
class MyTableItem < Fox::FXTableItem
def drawContent(table, dc, x, y, w, h)
dc.setTextFont(MY_FONT)
dc.foreground = Fox::FXRGB(255, 240, 240)
super(table, dc, x, y, w, h)
end
end
and then, when creating the table:
table.setItem(i, j, MyTableItem.new("hello"))
But well, that doesn’t work. Did I miss something?
On Tue, 27 Apr 2004 00:38:24 +0900 Jim Moy web@jimmoy.com wrote:
Yuri Leikind wrote: > Is there a way to set font for a single FXTableItem ? FXTableItem does not > have an appropriate method, there is only a way to set font for the whole > FXTable, globally. Call FXTableItem.setItem on your subclass of FXTableItem, then twiddle to your heart's content in drawContent.
–
Best regards,
Yuri Leikind
Yuri Leikind wrote:
Yuri Leikind wrote: > Is there a way to set font for a single FXTableItem ? FXTableItem does not > have an appropriate method, there is only a way to set font for the whole > FXTable, globally. Call FXTableItem.setItem on your subclass of FXTableItem, then twiddle to your heart's content in drawContent.
Perhaps you meant calling FXTable.setItem on my subclass of FXTableItem?
Yes, my mistake, I mis-typed.
Ok, I define my subclass of FXTableItem with drawContent :
class MyTableItem < Fox::FXTableItem
def drawContent(table, dc, x, y, w, h)
dc.setTextFont(MY_FONT)
dc.foreground = Fox::FXRGB(255, 240, 240)
super(table, dc, x, y, w, h)
But well, that doesn’t work. Did I miss something?
It looks like super() is overriding your font setting. Here’s what I do:
def drawContent(table, dc, x, y, w, h)
FXDCWindow.new( table ) do |mydc|
mydc.textFont = …
mydc.drawText(…)
end
end
Can’t remember why the param dc wasn’t usable and I had to do the mydc
thing, it’s been a while since I was in that code…
Jim
On Tue, 27 Apr 2004 00:38:24 +0900 > Jim Moy web@jimmoy.com wrote:
Thank you for your help
On Tue, 27 Apr 2004 23:52:58 +0900 Jim Moy web@jimmoy.com wrote:
Yuri Leikind wrote: > On Tue, 27 Apr 2004 00:38:24 +0900 > > Jim Moy <web@jimmoy.com> wrote: >> Yuri Leikind wrote: >> > Is there a way to set font for a single FXTableItem ? FXTableItem does not >> > have an appropriate method, there is only a way to set font for the whole >> > FXTable, globally. >> Call FXTableItem.setItem on your subclass of FXTableItem, then twiddle >> to your heart's content in drawContent. > Perhaps you meant calling FXTable.setItem on my subclass of FXTableItem? Yes, my mistake, I mis-typed. > Ok, I define my subclass of FXTableItem with drawContent : > class MyTableItem < Fox::FXTableItem > def drawContent(table, dc, x, y, w, h) > dc.setTextFont(MY_FONT) > dc.foreground = Fox::FXRGB(255, 240, 240) > super(table, dc, x, y, w, h) > But well, that doesn't work. Did I miss something? It looks like super() is overriding your font setting. Here's what I do: def drawContent(table, dc, x, y, w, h) FXDCWindow.new( table ) do |mydc| mydc.textFont = ... mydc.drawText(...) end end Can't remember why the param dc wasn't usable and I had to do the mydc thing, it's been a while since I was in that code...
–
Best regards,
Yuri Leikind