How to change the FXIcon in a FXButton at runtime?

Pof <[email protected]>
Newsgroups gmane.comp.lib.fox-toolkit.user
Message-ID <[email protected]>
Dear all,

In the MainWindow::MainWindow (derived from FXMainWindow):
I create a FXButton and attach an FXIcon (icon1) to it:
    btn = new FXButton(hframe,
                         "",
                         getApp()->icon1,
                         this,ID_TRANSFORM,
BUTTON_TOOLBAR|FRAME_RAISED|LAYOUT_CENTER_X|LAYOUT_CENTER_Y,
                         0,0,0,0,0,0,0,0);

Further on (outside the MainWindow constructor), I would like to be able 
to change the icon (i.e. at runtime).
Then I try:
     btn->setIcon(getApp()->icon2);
but this does not work, a MsgBox with "FXDCWindow:drawicon: illegal icon 
specified" is shown, and then the program crashes.
Any idea how to change the FXIcon in a FXButton at runtime?

Best regards,
Pof



_______________________________________________
Foxgui-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/foxgui-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.