Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to erase a image from the screen dynamically.

Former Member
0 Kudos

Hi..

I wanted to know how to erase a picture displayed in the screen dynamically.

I am displaying a picture in the screen using container. When I press a button picture will be displayed on that container. But if i press the button for the second time , Pictures displayed will be overlapped , and creates problem while scrolling. One of the image remains fixed , and another moves along with the scrolling bar.

Please help me to solve this problem.

Thank you...

1 ACCEPTED SOLUTION

former_member241258
Active Participant

hi can u follow below steps

1.when button clicked:

under button action perform free object of picture and container.

2. where pbo of screen to display picture.

create every time objects of container and picture.

use method of CL_GUI_PICTURE is like below

CALL METHOD GO_PIC1->SET_DISPLAY_MODE
EXPORTING
DISPLAY_MODE = CL_GUI_PICTURE=>DISPLAY_MODE_NORMAL_CENTER.

then u can get dynamic display of picture

9 REPLIES 9

former_member241258
Active Participant

hi can u follow below steps

1.when button clicked:

under button action perform free object of picture and container.

2. where pbo of screen to display picture.

create every time objects of container and picture.

use method of CL_GUI_PICTURE is like below

CALL METHOD GO_PIC1->SET_DISPLAY_MODE
EXPORTING
DISPLAY_MODE = CL_GUI_PICTURE=>DISPLAY_MODE_NORMAL_CENTER.

then u can get dynamic display of picture

0 Kudos

here i am giving sample code.

PBO.

DATA:LV_STATE TYPE I.

IF <CON_OBJ> is not initial.

LV_STATE = <CON_OBJ>->IS_ALIVE( ).

ENDIF.

check LV_STATE < 0 or <CON_OBJ> is initial.

<write here container object creation>

<write here picture object creation>

CALL METHOD <PIC_OBJ>->SET_DISPLAY_MODE
EXPORTING
DISPLAY_MODE = CL_GUI_PICTURE=>DISPLAY_MODE_NORMAL_CENTER.

PAI.

IF SY-UCOMM = '<BUTTON ACTION>'.

<PIC_OBJ>->FREE( ).

<CON_OBJ>->FREE( ).

ENDIF.

0 Kudos

Thanks a lot...This method works perfect for a single picture.

But in my case I am displaying 3 pictures in the screen using 3 different picture object and single container object.

Now only the 3rd picture is getting erased , whereas 1st and 2nd picture get overlapped with a empty picture. Is there any other solution other than creating 3 separate containers for 3 pictures.

I also wanted to know what is the difference between clear and free in this case.

Thank you.

0 Kudos

use 3 different containers to display.

0 Kudos

and 3 different pic objects to display pic

0 Kudos

Thank you..

Its working fine...

Sandra_Rossi
Active Contributor
0 Kudos

Please tell us how you display a "picture using container"? Which class for the image? Which type of container?

Could you please attach a screen capture too, because I don't understand how the scrollbar with one fixed image and one normal image look like?

raymond_giuseppi
Active Contributor

In the PBO, when the picture must be changed or removed you can use the method clear_picture before calling set_display_mode and the required load_picture_from_* method

Former Member

class for image : CL_GUI_PICTURE

container : type ref tocl_gui_custom_container.

I am trying to display 3 images in a subscreen which has a scroll bar.