-
Notifications
You must be signed in to change notification settings - Fork 2
events
James Bremner edited this page Oct 29, 2019
·
3 revisions
When user clicks on a widget ( presses the left mouse button ) the widget runs some default code.
Applications will often need other code to run when a widget is clicked. This can be arranged by registering a click event handler.
// display a button
wex::button& btn = wex::make<button>( form );
btn.move( {20, 250, 150, 30 } );
btn.text( "Do something" );
// register click event handler
btn.events().click([&]
{
... code to run when button clicked ...
});
void click( std::function<void(void)> f, bool propogate = false )
register click event handler. specify that click event should propogate to parent window after processing, default is false
void draw( std::function<void(PAINTSTRUCT& ps)> f )
void resize( std::function<void(int w, int h)> f )
void scrollH( std::function<void(int code)> f )
void scrollV( std::function<void(int code)> f )
/** Register function to run when menu item clicked
@param[in] id
@param[in] f function to run when menu item with id is clicked
*/
void menuCommand( int id, std::function<void(void)> f )
void mouseMove( std::function<void(sMouse& m)> f )
Register function to run when the mouse moves.
struct sMouse
{
int x;
int y;
bool left;
};