Additional Blogs by SAP
cancel
Showing results for 
Search instead for 
Did you mean: 
thomas_jung
Developer Advocate
Developer Advocate
0 Kudos
DATA prog_id(80). IF parent IS INITIAL. RAISE error_cntl_create. ENDIF. CLASS cl_gui_cfw DEFINITION LOAD. * assign prog_id to get the frontend specific control IF NOT activex IS INITIAL. prog_id = 'SAPTextLabel.SAPTextLabelUserControl'. ELSEIF NOT javabean IS INITIAL. RAISE gui_type_not_supported. ENDIF. IF prog_id IS INITIAL. RAISE gui_type_not_supported. ENDIF. * Set the window styles of the control when style parameter was not * set with constructor call. * For more information on the styles see WIN32 SDK IF style IS INITIAL. * otherwise the control would be invisible and the mistake would be * hard to find style = cl_gui_control=>ws_visible + cl_gui_control=>ws_child + cl_gui_control=>ws_clipsiblings. ENDIF. * Create the control CALL METHOD super->constructor EXPORTING clsid = prog_id shellstyle = style parent = parent lifetime = lifetime name = name EXCEPTIONS OTHERS = 1. CALL METHOD cl_gui_cfw=>flush EXCEPTIONS cntl_system_error = 1 cntl_error = 2 OTHERS = 3. IF sy-subrc <> 0. CALL METHOD me->install_controls. MESSAGE ID 'ZES_GENERAL' TYPE 'I' NUMBER 077. RAISE error_cntl_create. ENDIF. * register instance at framework CALL METHOD cl_gui_cfw=>subscribe EXPORTING shellid = h_control-shellid ref = me EXCEPTIONS OTHERS = 1. IF sy-subrc <> 0. RAISE error_cntl_create. ENDIF. *Setting Properties* Now we are ready to set our first property - the Caption. We will just create a method in ABAP Class called SET_CAPTION that accepts a single text string. The following is the code that we use to set a property through the control framework: CALL METHOD set_property EXPORTING property = 'Caption' value = caption EXCEPTIONS cntl_system_error = 1 cntl_error = 2 OTHERS = 3. *Calling Methods* Not too hard so far. Now we have our InitFont Method to call. Lets create a method in our ABAP Class called SET_FONT. The following are its input parameters:
21 Comments