| | | | Browse by category |
Article ID: 896
Last updated: 05 Feb, 2008
Problem
How do I change label font to match the cell font in a zTable?
Cause
Font needs to be changed from default.
Action
Follow these steps:
How do I change label font to match the cell font in a zTable?
Cause
Font needs to be changed from default.
Action
Follow these steps:
- Derive your own class from zTable (Object Factory does this for you).
- Override the drawlabel() function in your derived class.
- In drawLabel(), lock the canvas.
- Create the font you want and push it on the canvas.
- Call the base class drawLabel().
- Pop font and delete it.
- Unlock canvas and return.
- Call the base class drawLabel().
- In the main window, every time there is a selection change in the table, call setDirty(zTableRegion&) to redraw the previously selected portion. If this is not done, the previously selected portion will revert to the default font setting.
In the header file:
class Table1: public zTable{
public:
Table1(zWindow *w,zSizer *sz,DWORD s=0,zTableModel *m=0);
int drawLabel(zDrawEvt *ev);In the CPP file:
int Table1::drawLabel(zDrawEvt *ev){
canvas()->lock();
zFont *pFont=new zFont(Modern,1,zPrPoint(0,100),900,ffDontCare);
canvas()->pushFont(pFont);
int iret = zTable::drawLabel(ev);
delete canvas()->popFont();
canvas()-> unlock();
return iret;
}To change the font for the entire table, instead of zTable::drawLabel(zDrawEvt *ev) redefine the zTable::draw(zDrawEvt *ev)) method.
This article was:
Helpful |
Not helpful
Report an issue
Article ID: 896
Last updated: 05 Feb, 2008
Revision: 1
Views: 3723
Posted: 12 Jan, 1998 by
Dean J.
Updated: 05 Feb, 2008 by
Dean J.
Others in this category
Powered by KBPublisher (Knowledge base software)