Use getState() to determine if a check box is checked or not.
To make a widget redraw immediately (from within the GUI thread), just call its repaint() method.
To resize it immediately do a layout().
So you may need to change the widgets text then, relayout it parent, then redraw the parent to make it all look correct
MATRIX_BY_COLUMNSNOTE this for fox 1.7 (probably)
// Define an enum'd event ID something like this:
ID_EVENT_QUEUED_FROM_OTHER_THREAD
// Connect it to a handler
FXDEFMAP(MyApp) MyAppMap[]={
...
FXMAPFUNC( SEL_IO_READ, ID_EVENT_QUEUED_FROM_OTHER_THREAD, onCommand),
...
};
// After you make the application associate a signal with the event:
app->addInput( HandleSignal, INPUT_READ, this, ID_EVENT_QUEUED_FROM_OTHER_THREAD);
// When the signal is set it will call the handler in the GUI thread
onCommand
| Method | Description |
|---|---|
| … | |
void clearItems( FXbool notify = 0) | Empties the tree |
| … |
void ParseTree( SGFXLayersCallback *callback, FXTreeItem *item )
{
if (!item)
return;
while(item) {
/* Do something with the item */
callback->Callback( this, _tree, item );
/* Traverse Children */
ParseTree( callback, item->getFirst() );
/* Get the next item */
item=item->getNext();
}
}
ParseTree( callback, m_tree->getFirst() );
Specify a placement type when you show() or execute() the window or dialog.
| Value | Description |
|---|---|
| PLACEMENT_DEFAULT | Place it at the default size and location |
| PLACEMENT_VISIBLE | Place window to be fully visible |
| PLACEMENT_CURSOR | Place it under the cursor position DEFAULT for execute() |
| PLACEMENT_OWNER | Place it centered on its owner |
| PLACEMENT_SCREEN | Place it centered on the screen |
| PLACEMENT_MAXIMIZED | Place it maximized to the screen size |
(Also known as: context menu, right button menu)
// Connect it to something (like Right mouse button)
FXDEFMAP(SessionPane) SessionPaneMap[]={
...
FXMAPFUNC( SEL_RIGHTBUTTONPRESS, SessionPane::ID_LIST_SESSIONS, SessionPane::showContextMenu),
...
};
long SessionPane::showContextMenu( FXObject* sender, FXSelector sel, void *ptr)
{
FXEvent* event= (FXEvent*)ptr;
FXMenuPane *pPopupMenu = new FXMenuPane(this);
new FXMenuCommand( pPopupMenu, "Hide this message type", NULL, this, ID_HIDE_MESSAGE_TYPE);
new FXMenuSeparator( pPopupMenu, LAYOUT_FILL_X );
pPopupMenu->create();
pPopupMenu->popup(NULL, event->root_x,event->root_y);
getApp()->runModalWhileShown(pPopupMenu);
delete pPopupMenu;
return 1;
}
class ExampleDialog : public FXDialogBox
{
private:
FXDECLARE(ExampleDialog)
ExampleDialog() {}
public:
ExampleDialog( FXApp *pOwner);
~ExampleDialog(void) {}
};
FXDEFMAP(ExampleDialog) ExampleDialogMap[] = { 0 };
FXIMPLEMENT(ExampleDialog,FXDialogBox,ExampleDialogMap,ARRAYNUMBER(ExampleDialogMap))
ExampleDialog::ExampleDialog( FXApp *pOwner)
: FXDialogBox( pOwner, "Choose Run Mode", DECOR_ALL)
{
new FXLabel( this, "Text");
new FXButton( this, "Button");
FXList *pList;
pList = new FXList( this, 0, 0, LIST_NORMAL | LAYOUT_FILL_X);
pList->appendItem( "item 1");
pList->appendItem( "item 2");
FXComposite *pFrame;
pFrame = new FXHorizontalFrame( this);
new FXButton( pFrame, "Okay", 0, this, ID_ACCEPT);
new FXButton( pFrame, "Cancel", 0, this, ID_CANCEL);
create();
}
ExampleDialog dialog( foxAppPointer);
// Modal:
if ( dialog.execute()) {
// Okay was clicked
} else {
// Dialog was cancelled
}
// Nonmodal:
dialog.show();
create() show()
class SessionPane : public FXVerticalFrame
{
private:
// You Must FXDECLARE the derived class:
FXDECLARE(SessionPane);
// You Must have a no parameter constructor ( it is used by serialization )
protected:
SessionPane() {};
// Your other stuff goes here
}
FXDEFMAP(SessionPane) SessionPaneMap[]={
0
};
FXIMPLEMENT(SessionPane,FXVerticalFrame,SessionPaneMap,ARRAYNUMBER(SessionPaneMap))
| appendItem | FXint appendItem(FXListItem* item,FXbool notify=FALSE) |
| FXint appendItem(const FXString& text,FXIcon *icon=NULL,void* ptr=NULL,FXbool notify=FALSE) | |
| clearItems | void FXList::clearItems(FXbool notify) |
| findItem | FXint findItem(const FXString& text,FXint start=-1,FXuint flags=SEARCH_FORWARD|SEARCH_WRAP) const; |
| findItemByData | FXint findItemByData(const void *ptr,FXint start=-1,FXuint flags=SEARCH_FORWARD|SEARCH_WRAP) const |
| getCurrentItem | FXint getCurrentItem() Returns the index of the top most selected item, returns 0 if nothing is selected (which is the same as if the first item is selected) |
| getCursorItem | FXint getCursorItem() Returns the index of the item under the mouse pointer. returns -1 if the mouse is not over an item |
| getItem | FXListItem* getItem( FXint index) |
| getItemText | FXString getItemText(FXint index) const |
| getNumItems | FXint getNumItems() const |
| insertItem | FXint insertItem(FXint index,FXListItem* item,FXbool notify=FALSE); |
| FXint insertItem(FXint index,const FXString& text,FXIcon *icon=NULL,void* ptr=NULL,FXbool notify=FALSE); | |
| isItemSelected | FXBool isItemSelected( FXint index) Returns true if the item is selected. |
| killSelection | void killSelection() Deselects all |
| removeItem | void removeItem(FXint index,FXbool notify) |
| Widget | Events | Selected Methods |
|---|---|---|
| FXButton | SEL_COMMAND | FXuint getState() const |
| FXCheckButton | SetCheck( FXbool isChecked = true) | |
| FXbool getCheck() | ||
| FXComboBox | void clearItems() | |
| FXint appendItem(const FXString& text,void* ptr=NULL) | ||
| FXMatrix | ||
| FXSpinner | void setValue(FXint value) | |
| FXSpinner(FXComposite *p,FXint cols,FXObject *tgt=NULL,FXSelector sel=0,FXuint opts=SPIN_NORMAL,FXint x=0,FXint y=0,FXint w=0,FXint h=0,FXint pl=DEFAULT_PAD,FXint pr=DEFAULT_PAD,FXint pt=DEFAULT_PAD,FXint pb=DEFAULT_PAD); | ||
| FXTextField | FXString getText() const |
FXDEFMAP( class ) arbitraryUniqueNameOfMap[] = {
// Single Message Handler
FXMAPFUNC( messageType, messageId, handlerMethod)
FXMAPFUNCS( messageType, lowestMessageId, highestMessageId, handlerMethod )
};
FXIMPLEMENT
long handlerMethod( FXObject *pObj, FXSelector sel, void *???); // pObj is the Source of the event (usually a Widget) // FXSELID(sel) is the ID of the event that caused the handler to be called
| messageType | Description |
|---|---|
| SEL_NONE | |
| SEL_KEYPRESS | Key pressed |
| SEL_KEYRELEASE | Key released |
| SEL_LEFTBUTTONPRESS | Left mouse button pressed |
| SEL_LEFTBUTTONRELEASE | Left mouse button released |
| SEL_MIDDLEBUTTONPRESS | Middle mouse button pressed |
| SEL_MIDDLEBUTTONRELEASE | Middle mouse button released |
| SEL_RIGHTBUTTONPRESS | Right mouse button pressed |
| SEL_RIGHTBUTTONRELEASE | Right mouse button released |
| SEL_MOTION | Mouse motion |
| SEL_ENTER | Mouse entered window |
| SEL_LEAVE | Mouse left window |
| SEL_FOCUSIN | Focus into window |
| SEL_FOCUSOUT | Focus out of window |
| SEL_KEYMAP | |
| SEL_UNGRABBED | Lost the grab (Windows) |
| SEL_PAINT | Must repaint window |
| SEL_CREATE | |
| SEL_DESTROY | |
| SEL_UNMAP | |
| SEL_MAP | |
| SEL_CONFIGURE | resize |
| SEL_SELECTION_LOST | Widget lost selection |
| SEL_SELECTION_GAINED | Widget gained selection |
| SEL_SELECTION_REQUEST | Inquire selection data |
| SEL_RAISED | Window to top of stack |
| SEL_LOWERED | Window to bottom of stack |
| SEL_CLOSE | Close window |
| SEL_DELETE | Delete window |
| SEL_MINIMIZE | Iconified |
| SEL_RESTORE | No longer iconified or maximized |
| SEL_MAXIMIZE | Maximized |
| SEL_UPDATE | GUI update |
| SEL_COMMAND | GUI command |
| SEL_CLICKED | Clicked |
| SEL_DOUBLECLICKED | Double-clicked |
| SEL_TRIPLECLICKED | Triple-clicked |
| SEL_MOUSEWHEEL | Mouse wheel |
| SEL_CHANGED | GUI has changed |
| SEL_VERIFY | Verify change |
| SEL_DESELECTED | Deselected |
| SEL_SELECTED | Selected |
| SEL_INSERTED | Inserted |
| SEL_REPLACED | Replaced |
| SEL_DELETED | Deleted |
| SEL_OPENED | Opened |
| SEL_CLOSED | Closed |
| SEL_EXPANDED | Expanded |
| SEL_COLLAPSED | Collapsed |
| SEL_BEGINDRAG | Start a drag |
| SEL_ENDDRAG | End a drag |
| SEL_DRAGGED | Dragged |
| SEL_LASSOED | Lassoed |
| SEL_TIMEOUT | Timeout occurred |
| SEL_SIGNAL | Signal received |
| SEL_CLIPBOARD_LOST | Widget lost clipboard |
| SEL_CLIPBOARD_GAINED | Widget gained clipboard |
| SEL_CLIPBOARD_REQUEST | Inquire clipboard data |
| SEL_CHORE | Background chore |
| SEL_FOCUS_SELF | Focus on widget itself |
| SEL_FOCUS_RIGHT | Focus movements |
| SEL_FOCUS_LEFT | |
| SEL_FOCUS_DOWN | |
| SEL_FOCUS_UP | |
| SEL_FOCUS_NEXT | |
| SEL_FOCUS_PREV | |
| SEL_DND_ENTER | Drag action entering potential drop target |
| SEL_DND_LEAVE | Drag action leaving potential drop target |
| SEL_DND_DROP | Drop on drop target |
| SEL_DND_MOTION | Drag position changed over potential drop target |
| SEL_DND_REQUEST | Inquire drag and drop data |
| SEL_IO_READ | Read activity on a pipe |
| SEL_IO_WRITE | Write activity on a pipe |
| SEL_IO_EXCEPT | Except activity on a pipe |
| SEL_PICKED | Picked some location |
| SEL_QUERY_TIP | Message inquiring about tooltip |
| SEL_QUERY_HELP | Message inquiring about statusline help |
| SEL_LAST |