MainFormHandleEvent.c |
---|
#include "MainFormHandleEvent.h" Boolean MainFormHandleEvent(EventPtr event) { FormPtr frm; Boolean handled = false; switch (event->eType) { case ctlSelectEvent: if (event->data.ctlEnter.controlID == MainHelloButton) { WinDrawChars("Hello world!", 12, SysRandom(0) % 110, SysRandom(0) % 100 + 20); handled = true; } // MainHelloButton break; // ctlSelectEvent: case frmOpenEvent: frm = FrmGetActiveForm(); FrmDrawForm(frm); handled = true; break; // frmOpenEvent: } // event->eType return handled; } // MainFormHandleEvent |
The case ctlSelectEvent has been added. This event is send when a control is selected (a button pushed for example). When this happens we check if the controlID is equal to the id of the button. Now we know the button has been pressed. The text Hello world! is put on a random place on the screen.
The application has put Hello world! on the screen. |
More Hello world! on the screen. |
Toni Cornelissen 13 September 2004 toni@dse.nl |
Daily horoscope |