12-21-2007 10:24 AM
Hi all,
can anyone tell me as to what is meant by this statement.
DATA : event TYPE REF TO CL_HTMLB_EVENT.
Statement 1:
event = cl_htmlb_manager=>get_event( runtime->
server- >request)
Data :button_event TYPE REF TO CL_HTMLB_EVENT_BUTTON.
Statement 2:
button_event ?= event.
Please explain to me statement 1 and ststement 2.
Regards,
Saurabh
12-21-2007 10:32 AM
the first statement is calling a method of a class & the value returned by it will be assigned to the field EVENT.
the 2nd statement is asigning the object event to button event.
12-21-2007 11:22 AM
Hi Sayak,
Thanks for your reply.
can you please elaborate as to how the first statement works.
What is runtime -> server -> request ?
What is this ?
Please elaborate.
Regards,
Suarabh
12-21-2007 11:33 AM
the code runs at server side (or may be at your own system)
whenever any event occur say a button is pressed, its function ket is send to server as an event
you should know what is the the function key of the button
and the code you want to execute on selection of the button is executed when the check - if event = 'FUNCTION_KEY' returns true.
12-21-2007 11:36 AM
12-21-2007 1:07 PM
1) "runtime" is a reference to an object. It has an attribute "server" that is a reference to an object. "server" has an attribute "request".
The static method get_event on class cl_htmlb_manager is called using this "request" as an import parameter, and returns an event, type reference to CL_HTMLB_EVENT.
2) CL_HTMLB_EVENT_BUTTON is a subclass of CL_HTMLB_EVENT. The first statement returns a result that is a reference to a CL_HTMLB_EVENT. But in order to handle a button event properly, it must be converted to a reference to a CL_HTMLB_EVENT_BUTTON. And that's what the ?= does. It casts the superclass object to the subclass object.
matt