on 06-10-2011 5:07 PM
Hello All
I am creating Dynamic tray with following code in WDMODIFYVIEW Method in the View.
But it giving error "Access via 'NULL' object reference not possible."
What is wrong in below code please let me know.
data lr_cntr type REF TO cl_wd_uielement_container. .
data lr_tray type REF TO cl_wd_tray.
lr_cntr ?= VIEW->GET_ELEMENT( 'ROOTUIELEMENTCONTAINER').
lr_tray = cl_wd_tray=>NEW_TRAY(
CONTEXT_MENU_BEHAVIOUR = cl_wd_tray=>E_CONTEXT_MENU_BEHAVIOUR-INHERIT
DESIGN = cl_wd_tray=>E_DESIGN-TRANSPARENT
id = 'MYTRAY'
width = '100'
ENABLED = 'X'
EXPANDABLE = 'X'
EXPANDED = 'X'
HAS_CONTENT_PADDING = 'X'
SCROLLING_MODE = cl_wd_tray=>E_SCROLLING_MODE-NONE
VISIBLE = cl_wd_tray=>E_VISIBLE-VISIBLE
).
cl_wd_flow_data=>new_flow_data( element = lr_tray ).
cl_wd_matrix_layout=>new_matrix_layout( container = lr_tray ).
lr_cntr->add_child( lr_tray ).
BR
-CW
On exactly which line you get this error?. probably THE lr_tray is initial. in that case please check of you have missed Any parameter for THE constructor.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Goto st22 and check where you are getting error. OR Debugg your code and find which statement is initial. Try to initial that
it will resolve.
Cheers,
Kris.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello
I am getting the Tray but i am not aable add elements into the tray used below code.
In the below i have tried adding button to the Tray.
Button is coming outside of the Tray.
What is wrong in below code.
data lr_cntr type REF TO cl_wd_uielement_container. .
data lr_tray type REF TO cl_wd_tray.
data lr_te type REF TO cl_wd_text_edit.
data lr_tv type REF TO cl_wd_text_view.
data OREF type ref to CX_ROOt.
data TEXT type STRING.
data lr_btn TYPE REF TO cl_wd_button.
lr_cntr ?= VIEW->GET_ELEMENT( 'ROOTUIELEMENTCONTAINER').
*lr_tray = cl_wd_tray=>NEW_TRAY( ).
lr_tray = cl_wd_tray=>NEW_TRAY(
CONTEXT_MENU_BEHAVIOUR = cl_wd_tray=>E_CONTEXT_MENU_BEHAVIOUR-INHERIT
DESIGN = cl_wd_tray=>E_DESIGN-TRANSPARENT
id = 'MYTRAY'
width = '100%'
ENABLED = 'X'
EXPANDABLE = 'X'
EXPANDED = 'X'
HAS_CONTENT_PADDING = 'X'
SCROLLING_MODE = cl_wd_tray=>E_SCROLLING_MODE-NONE
VISIBLE = cl_wd_tray=>E_VISIBLE-VISIBLE
).
cl_wd_flow_data=>new_flow_data( element = lr_tray ).
cl_wd_matrix_layout=>new_matrix_layout( container = lr_tray ).
lr_cntr->add_child( lr_tray ).
lr_btn = cl_wd_button=>new_button( ).
CALL METHOD lr_btn->SET_TEXT
EXPORTING
VALUE = 'My Button'.
cl_wd_matrix_head_data=>new_matrix_head_data( element = lr_btn ).
lr_tray->add_child( lr_btn ).
Hi Williams,
Try with this code, i am getting Tray and button, button is inside the tray, Check it by collapsing tray you will get idea.
data lr_cntr type REF TO cl_wd_uielement_container. .
data lr_tray type REF TO cl_wd_tray.
data lr_te type REF TO cl_wd_text_edit.
data lr_tv type REF TO cl_wd_text_view.
data OREF type ref to CX_ROOt.
data TEXT type STRING.
data lr_btn TYPE REF TO cl_wd_button.
lr_cntr ?= VIEW->GET_ELEMENT( 'ROOTUIELEMENTCONTAINER').
*lr_tray = cl_wd_tray=>NEW_TRAY( ).
lr_tray = cl_wd_tray=>NEW_TRAY(
CONTEXT_MENU_BEHAVIOUR = cl_wd_tray=>E_CONTEXT_MENU_BEHAVIOUR-INHERIT
DESIGN = cl_wd_tray=>E_DESIGN-FILL // You can try with TRANSAPARENT also.
id = 'MYTRAY'
width = '100%'
ENABLED = 'X'
EXPANDABLE = 'X'
EXPANDED = 'X'
HAS_CONTENT_PADDING = 'X'
SCROLLING_MODE = cl_wd_tray=>E_SCROLLING_MODE-NONE
VISIBLE = cl_wd_tray=>E_VISIBLE-VISIBLE
).
cl_wd_matrix_data=>new_matrix_data( element = lr_tray ).
cl_wd_matrix_layout=>new_matrix_layout( container = lr_tray ).
lr_cntr->add_child( lr_tray ).
lr_btn = cl_wd_button=>new_button( ).
CALL METHOD lr_btn->SET_TEXT
EXPORTING
VALUE = 'My Button'.
cl_wd_matrix_head_data=>new_matrix_head_data( element = lr_btn ).
lr_tray->add_child( lr_btn ).
Cheers,
Kris.
User | Count |
---|---|
88 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.