Project Home
Project Home
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - Dyncamic Layout for widgets: (10 Items)
   
Dyncamic Layout for widgets  
How can I dynamically layout the widgets in my window?

One of the requirements of my application is for all of it's windows to be displayed full screen because the purpose of 
the app is for it to be used in a kiosk type station.  Since the target screen size is unknown at this time, I need to 
be able to move my widgets around dynamically depending upon the size of the window.

Here is what I have done so far:

1. I set the window's Pt_ARG_WINDOW_STATE to Ph_WM_STATE_ISMAX
2.I have used PhAB to group the widgets in to two separate groups.  PtGroupA and PtGroupB.  

I need to have PtGroupA always in the center (vertical and horizontal) of the window.  I need PtGroupB always in the top
 right corner.

I have read the "Widget Geometry" section of the programmers guide and I see how to set the position using the 
Pt_ARG_POS attribute, but I don't know how to determine the usable coordinates (the canvas) of the parent window so that
 I can calculate the Pt_ARG_POS value for each PtGroup.

I also saw something about setting a Layout Policy, but I didn't find too much information on this.

Is this something that can be done via settings in PhAB or is it something that I have to write the code for?

Thanks for any help.

Kendall
Re: Dyncamic Layout for widgets  
Re: Dyncamic Layout for widgets  

It looks like anchors may serve the purpose that I need.

The documentation states that the anchor offset can be expressed as a proportion, but it does not explain how to set it 
as a proportion.

I found some (I assume) older documentation that indicates I should set the Pt_ARG_ANCHOR_FLAGS to 
Pt_LEFT_ANCHORED_RELATIVE, etc..., but that token is not defined when I compile the code.  I assume that is not a valid 
define any longer.


http://www.lfbs.rwth-aachen.de/~stefan/docs/photon/widget_ref/ptwidget.html#Pt_ARG_ANCHOR_FLAGS

Re: Dyncamic Layout for widgets  
Proportional anchors are no longer supported. Layouts should be used instead.
Re: Dyncamic Layout for widgets  
I understand.

Thank you for your help.

Re: Dyncamic Layout for widgets  
One additional question...

I have successfully configured the layout that I need by setting the resources completely inside of PhAB.  

However, for our purposes, I think it would be best to actually handle the layout inside the code.

In that case, where is the appropriate place to add the code for the layout?  The window setup function, the window 
realized callback or somewhere else?

Thank you,
Kendall
Re: Dyncamic Layout for widgets  
You are correct -- Pt_CB_REALIZED is one place. The other place is Pt_CB_RESIZE.
I still recommend using layout. It is a very flexible and powerful feature. 
Re: Dyncamic Layout for widgets  
I am using layouts.

I just wanted to add the code for the layouts to my module instead of using PhAB to set all of that up.  

I appreciate your help.

Thank you. 
Re: Dyncamic Layout for widgets  
I think -- "I don't understand your question". Could you please describe it a little more.
Re: Dyncamic Layout for widgets  
I don't have a question any longer, you answered it.

Basically all I was saying in my last post is that I recognize that there are two ways to implement layouts.

1) Using PhAB - By modifying the resources that are attached to the widgets.  
2) Code - writing the code from scratch and putting it in the realized call back.

I have currently implemented it using the 1st method above, but I am going to move to using the 2nd method above.

You answered my question by telling me where to put the code for the 2nd method above.  The realized callback and/or the
 resize callback.

Thank you again.

Kendall

> I think -- "I don't understand your question". Could you please describe it a 
> little more.