Code: Alles auswählen.
method constructor.
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 = 'Listbox.UserControl1'.
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
data style type i.
* 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.
* Create the control
call method super->constructor
exporting
clsid = prog_id
shellstyle = style
parent = parent
lifetime = lifetime
name = name
exceptions
others = 1.
if sy-subrc <> 0.
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.
* Wenn das OCX-Control eine Eigenschaft "Caption" hat - also z.B. ein Button - dann kann man den Text so setzen:
*CALL METHOD OF H_CONTROL-OBJ 'SetCaption' NO FLUSH
*EXPORTING #1 = 'ENNO'.
* create and initialize dataprovider => m_dp_handle
call function 'DP_CREATE'
changing
h_dp = m_dp_handle
exceptions
dp_create_error = 1
dp_install_error = 2
dp_error = 3
others = 4.
if sy-subrc <> 0.
raise error_dp_create.
endif.
endmethod.Code: Alles auswählen.
data gr_container type ref to cl_gui_custom_container.
data gr_listbox type ref to zcl_control.
data gv_entries type string.
start-of-selection.
call screen 100.
end-of-selection.
*&---------------------------------------------------------------------*
*& Module STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
module status_0100 output.
set pf-status '100'.
perform init_controls.
endmodule. " STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
module user_command_0100 input.
case sy-ucomm.
when 'BACK'.
set screen 0.
leave screen.
endcase.
endmodule. " USER_COMMAND_0100 INPUT
form init_controls.
if gr_container is initial.
create object gr_container
exporting
container_name = 'CONTAINER'
exceptions
others = 6.
create object gr_listbox
exporting
parent = gr_container
name = 'Listbox'
exceptions
gui_type_not_supported = 1
error_cntl_create = 2
error_dp_create = 3
others = 4.
if sy-subrc <> 0.
endif.
endif.
endform.Code: Alles auswählen.
Private Sub ListBox1_Click()
End SubCode: Alles auswählen.
*CALL METHOD OF H_CONTROL-OBJ 'SetCaption' NO FLUSH
*EXPORTING #1 = 'ENNO'.

Code: Alles auswählen.
Option Explicit
Public Property Get BackColor() As OLE_COLOR
BackColor = UserControl.Text.BackColor
End Property
Public Property Let BackColor(ByVal New_BackColor As OLE_COLOR)
If UserControl.Text.BackColor() = New_BackColor Then Exit Property
UserControl.Text.BackColor() = New_BackColor
PropertyChanged "BackColor"
End Property