Application Development and Automation 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: 
Read only

DialogControl Metrics

Clemenss
Active Contributor
0 Likes
624

Hi,

I'm confused about metrics.

In my application, I want to be able to create as many dialog control pop ups as the user wants. Now I want to position the controls so that as many pop ups as possible are visible at the same time.

Say, my control as a width and height of a and b units (pixels?) and is put at position LEFT = x and TOP = y .

Now, I calculate x = x + a for the LEFT position of the next pop up, that works fine. Now, when the next one has not enough space on the right (x + a GT MAXWIDTH), I will switch to the next row. TOP = TOP_first_row + MAX(HEIGHT_first_row.

But now I have far too much space between the rows of pop ups.

Obviously there is another scaling for the TOP value and for the HEIGTH value.

I'm stuck here to find some logic for this.

Any idea on how to determine that correctly or any hint about (missing) documentation?

Thanks.

Regards,

Clemens

1 ACCEPTED SOLUTION
Read only

naimesh_patel
Active Contributor
0 Likes
538

I had also observed the same behavior. It's Weird!

I have tried with different combination of the height and looks like 70% is the closest to remove the additional row spacing. No clue at all, how this math works...!


    v_width  = 540.
    v_height = 120.
    v_Top    = 50.
    v_left   = 50.
...
    v_width  = 540.
   "<< 70 of the height of the other row
    v_top    = v_top + ( ( v_height * 70 ) / 100 ).   
    v_height = 100.
    v_left   = 50.

Regards,

Naimesh Patel

Hi,

I'm confused about metrics.

In my application, I want to be able to create as many dialog control pop ups as the user wants. Now I want to position the controls so that as many pop ups as possible are visible at the same time.

Say, my control as a width and height of a and b units (pixels?) and is put at position LEFT = x and TOP = y .

Now, I calculate x = x + a for the LEFT position of the next pop up, that works fine. Now, when the next one has not enough space on the right (x + a GT MAXWIDTH), I will switch to the next row. TOP = TOP_first_row + MAX(HEIGHT_first_row.

But now I have far too much space between the rows of pop ups.

Obviously there is another scaling for the TOP value and for the HEIGTH value.

I'm stuck here to find some logic for this.

Any idea on how to determine that correctly or any hint about (missing) documentation?

Thanks.

Regards,

Clemens

2 REPLIES 2
Read only

naimesh_patel
Active Contributor
0 Likes
539

I had also observed the same behavior. It's Weird!

I have tried with different combination of the height and looks like 70% is the closest to remove the additional row spacing. No clue at all, how this math works...!


    v_width  = 540.
    v_height = 120.
    v_Top    = 50.
    v_left   = 50.
...
    v_width  = 540.
   "<< 70 of the height of the other row
    v_top    = v_top + ( ( v_height * 70 ) / 100 ).   
    v_height = 100.
    v_left   = 50.

Regards,

Naimesh Patel

Read only

0 Likes
538

Hi Naimesh,

meanwhile I found out a little more:

First: Creating a container you can pass a parameter to set the way metrics are used: I tried successful using

CREATE OBJECT lio_gui_dialogbox_container
  EXPORTING
    width  = liv_width
    height = liv_height
    top    = liv_top
    left   = liv_left
    metric = cl_gui_container=>metric_pixel
  EXCEPTIONS
    OTHERS = 1.

There are constantrs for cl_gui_container=>metric_pixel, cl_gui_container=>metric_mm and cl_gui_container=>metric_default Nobody knows what default means, pixel works good combined with

METHOD constructor.
  DATA:
    ls_factors   TYPE cntl_metric_factors.
  ls_factors = cl_gui_cfw=>get_metric_factors( ).
  cl_gui_cfw=>flush( ).
  lsv_graph_units_per_row  = ls_factors-char_complete-y.
  lsv_graph_units_per_col  = ls_factors-char_complete-x.
  lsv_screen_width         = ls_factors-screen-x.
  lsv_screen_height        = ls_factors-screen-y.
ENDMETHOD.

Those 'metric factors' look like the number of pixels.

I did some dynamic scaling of my containers and it looks quite satisfying though far away from perfect.

The next really hard question is: What is the with in pixels of an ALV (SALV) grid cell with column optimized at run time? If you save it in a layout variant, it will restore that size if loaded. But I have no idea on how the values are determined and/or sett. The layout variant information is stored in long line cluster table. Right now I'm not willing or able to analyze it.

Regards,

Clemens