27
Jun/09
0

How to set image width?


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 1139 times by 412 viewers

Related Posts

Comments (0) Trackbacks (0)

No comments yet.

Leave a comment

No trackbacks yet.

Powered by Yahoo! Answers