How to set image width?

June 27, 2009 by admin
Filed under: ABAP Objects 


I’m using this method but image never stay in container size in screen. Always appears horizontal and vertical scrools bar.

Bellow, Method SET_WIDTH does not work:

* picture Control.
DATA picture TYPE REF TO cl_gui_picture.

?? CREATE OBJECT container
?????? EXPORTING container_name = ‘CUSTOM’.

* create the picture control
?? CREATE OBJECT picture
?????? EXPORTING parent = container.

* load picture
?? CALL METHOD picture->load_picture_from_url
?????? EXPORTING url = url.

* load picture
?? CALL METHOD picture->SET_WIDTH
?????? EXPORTING width = WIDTH.

* load picture
?? CALL METHOD picture->SET_HEIGHT
?????? EXPORTING HEIGHT = 5.

If you want to fit it to container. The solution is :

CALL METHOD picture->set_display_mode
?? EXPORTING
????? display_mode = cl_gui_picture=>display_mode_fit.

Other available modes:

  • DISPLAY_MODE_FIT_CENTER
  • DISPLAY_MODE_NORMAL
  • DISPLAY_MODE_NORMAL_CENTER
  • DISPLAY_MODE_STRETCH

Ans by Marcin


Viewed 1192 times by 434 viewers

Related SAP Solutions :

Comments

Tell me what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!





SAP Solution Database