Eventtype is a set of bits creating a mask that indicates which type of information exists in the event structure (
IT_EVENT) and all of its related structures.Using the Eventtype Bits
The GUI Library uses the eventtype data to communicate the type of information that exists in the event structure between your program and the R/3 application server.
Some of the bits in eventtype are set by your application, while others are set by the GUI Library as a result of the information coming in from R/3.
The values of the bits in eventtype play an important role when you either get or send the contents of the event structure to or from the R/3 application server.
Bits Set up by Your Application
Your application sets some of the bits in eventtype before sending an event to the application server with either the It_SendEvent or the It_SendEventEx functions.
These bits indicate to the application server which type of information exists in the event structure you are sending to it. When you send certain types of information from the event structure to R/3, you must set the relevant eventtype bits.
Eventtype MES_* Values
The following table lists the eventtype bits that are set by your application before sending an event. The table describes when you should set each of the bits:
Bit |
Turn on to Indicate that the Event You Are Sending Contains… |
MES_KEY |
A PFKey |
MES_OKCODE |
An OKCODE. This is the contents of the SAGGUI command filed, where you usually enter a transaction number. |
MES_MENU |
A request for a specific menu option |
MES_SET_CUR_POS |
A set of one or more controls on the screen, and one of them has focus |
MES_SET_SIZE |
A change in the size of user area of the screen |
MES_HSCROLL |
A request for a horizontal scroll. Specify the row or column position to scroll to with the lPos member of IT_EVENT. |
MES_VSCROLL |
A request for a vertical scroll. Specify the row or column position to scroll to with the lPos member of IT_EVENT. |
MES_HELP_MES |
A request for the help of the current message |
MES_HELP_MENU |
A request for the help of the current menu |
MES_HELP_OK |
A request for the help on the OK code field (the Command field in the SAPGUI). Note that this type of help information is not particularly interesting, because it always returns the same help information: how to use the Command field. |
MES_HELP_FKEY |
A request for the help of the push-button key. This is the help you get when pressing F1 while a toolbar button has focus. Note that this feature is not useful in recent R/3 releases. |
Procedure
For example, if you wish to send an event that contains choosing of a toolbar key (sending a PFKey to R/3), you must perform the following steps:
Example
The following example changes the size of the screen. It sets the MES_SET_SIZE to indicate that there is a change in the size of the screen, and then sends the event to the application server:
pEvt->eventtype |= MES_SET_SIZE ;
printf("Row: %d\tCol:%d \n", pEvt->screen.dimrow, pEvt->screen.dimcol);
unsigned short temp = pEvt->screen.dimrow * 1.4;
pEvt->screen.dimrow = temp;
temp = pEvt->screen.dimcol * 1.2;
pEvt->screen.dimcol = temp;
if (It_SendEvent(hndl, &pEvt) == FALSE) {
printf("error in sendevent\n");
return;
}
The GUI Library offers several helper functions for changing some of the controls on the screen (some of the functions that start with ItEv_Set*). These functions internally set the appropriate MES_* bit when necessary, so that you do not have to do so when using these functions
For example, the function ItEv_SetOkCode assisgns the OKCode you specify to the okcode member of the IT_EVENT structure, and it sets the MES_OKCODE bit on:
lstrcpy(pEvt->okcode, okcode);
pEvt->eventtype |= MES_OKCODE;
Bits Set up by GUI Library
The GUI library sets the other bits in eventtype as a result of the information coming from the R/3 application server regarding the data that exists in the event structure (and all of its related structures).
You use the values of the bits in eventtype after getting an event from with either the It_GetEvent or the It_GetEventEx functions, to see which type of information exists in the event. For example, if EVT_MESSAGE is on, you know that the szMessage member of the IT_EVENT structure contains a message, and you can obtain the contents of this message. If the EVT_MESSAGE is off, you do not need to check for such a message.
Eventtype EVT_* Values
The following table lists the eventtype bits that you can query after sending an event. The table describes what each of the bits indicates:
Bit |
If On, It Indicates that… |
EVT_SCREEN |
The event structure contains the screen and controls definition. Note that if this bit is off it means that the event structure had been initialized, but it does not contain an event. |
EVT_MESSAGE |
The event structure contains message. |
EVT_STATIC_INFO |
The static information portion of the IT_EVENT structure is available, this means that the information of the szDB and nDiagVersion members, for example, is available. |
EVT_TITLE |
SzNormTitle contains the title of the screen. |
EVT_PFKEY |
The event structure contains key definitions. |
EVT_DIALOG_DISMISSED |
(This bit is not used in current release). |
EVT_OKCODE |
The event structure contains an okcode value. |
EVT_MENU |
The menu structure is active on the screen. |
EVT_TERM_CLR |
Terminal clear. This is not used much in recent releases of R/3. It was used mostly by older, screen-based R/2 systems, for example, to clear the screen before displaying another screen. |
EVT_DYNPRO_INFO |
szProgramName and szScreenName fields in the Screen structure contain the name of the program and screen. |
EVT_SEND_FRONT_EVT_REQ |
The event was sent from the SAPGUI Front. |
EVT_END_OF_SESSION |
The session associates with this event had been closed. This could occur for example, as a result of a user logging off, or as a result of a user closing the window of the current session. |
EVT_FRONT_RUNNING |
SAPGUI Front is running. (Check this flag before sending an event to Front). |
EVT_END_OF_TRANSACTION |
End of the transaction was received for current transaction in process. |
EVT_SESSION_ADDED |
A new session associated with this event had started. |
Example
The following example checks if there is a title to the window, and then prints it:
if(pEvt->eventtype & EVT_TITLE) {
printf("Title: %s\n", pEvt->szNormTitle);
}
The following example checks if there is a message on the screen, and then prints it:
if(pEvt->eventtype & EVT_MESSAGE) {
printf("Message !!: %s\n", pEvt->szMessage);
}