Project Home
Project Home
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - Grid Layout affects size of widgets: (5 Items)
   
Grid Layout affects size of widgets  
When I apply the Grid Layout to a window with three widgets, the size of the widgets are changed.

I have a window designed in PhAB that has three widgets. (see attached image)

1. A PtLabel widget is top center
2. A PtMultiText is below the PtLabel.  The PtMultiText takes up the majority of the screen width.
3. A PtButton is on the bottom right.  [OK]

The issue that I am having is:
1. In PhAB, when I change this window to a Grid Layout, the PtMultiText and the PtButton widgets both shrink.  The 
PtButton widget shrinks to just large enough to display the "OK" text, and the PtMultiText shrinks to where the vertical
 scroll bar is all that is visible.

2. If I resize the widgets manually in PhAB and set up the resources for each widget to be placed correctly in the Grid 
Layout, then everything appears fine in PhAB.  However, if I attempt to make the window smaller in PhAB, or when I run 
the application, the widgets are again automatically resized to the smaller size.

I have used the Grid Layout in two other windows without any problem.  However, in those other windows, all of the 
individual widgets are grouped into PtGroup widgets.  I did not do that for this window because there are only three 
widgets and I need the PtMultiText widget to resize if the size of the window changes.  (Horizontal Grab and Vertical 
Grab)

Attachment: Image WidgetResize.JPG 98.29 KB
Re: Grid Layout affects size of widgets  
I can't tell exactly where the problem is. Based on your description I think you need to instruct the cell with the 
PtMultiText to grab excessive horizontal and vertical spacing. 

1. To do this take a look at this doc: http://www.qnx.com/developers/docs/6.5.0/topic/com.qnx.doc.photon_widget_ref/
ptwidget.html?path=17_2_2_75_4_12#Pt_ARG_GRID_LAYOUT_DATA
This data should attached to the PtMultiText -- PhAB allows you to do this.

2. Make sure that the Window or the layout container has Pt_AUTO_EXTENT flag set in the Pt_ARG_CONTAINER_FLAGS. This 
will cause the container to "show changes" immediately during desing.
Re: Grid Layout affects size of widgets  
Thank you for your response, but I ended up getting it to work by putting the widgets in groups.  The PtMultiText 
widgets behaves as expected when I put it in a group by itself.

If I have to go back and change that, then I will attempt to use your pointers.

Thanks again,
Kendall

Re: Grid Layout affects size of widgets  
Layouts will set the sizes of the widgets to their ALWAYS re-sizing policy. If this is not what you want you need to 
give size hints to these widgets. See the same GRID_DATA docs as above.
Re: Grid Layout affects size of widgets  
I have attempted to do this on another window and here are my results.

When I set the PtMultiText Grid Layout flags to HORIZONTAL ALIGN FILL, VERTICAL ALIGN FILL, HORIZONTAL GRAB and VERTICAL
 GRAB it works as I expect.  (It grows to fill the window when the window is maximized)

I am still having issues with the PtButton.  I want it to remain at a set size, but it always shrinks to be just big 
enough for the text (Pt_ARG_STRING_TEXT).  The button is a simple [OK] button, so the size ends up being pretty small.

The PtLabel widgets also shrink to be just large enough to display the text contained in them.



> I can't tell exactly where the problem is. Based on your description I think 
> you need to instruct the cell with the PtMultiText to grab excessive 
> horizontal and vertical spacing. 
> 
> 1. To do this take a look at this doc: http://www.qnx.com/developers/docs/6.5.
> 0/topic/com.qnx.doc.photon_widget_ref/ptwidget.html?path=17_2_2_75_4_12#
> Pt_ARG_GRID_LAYOUT_DATA
> This data should attached to the PtMultiText -- PhAB allows you to do this.
> 
> 2. Make sure that the Window or the layout container has Pt_AUTO_EXTENT flag 
> set in the Pt_ARG_CONTAINER_FLAGS. This will cause the container to "show 
> changes" immediately during desing.