Project Home
Project Home
Trackers
Trackers
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - Sorry, I am new here: Is there a method to find out window total and client areas?: (11 Items)
   
Sorry, I am new here: Is there a method to find out window total and client areas?  
As far as I know, Windows have very simple function calls to do that. But here, when I try to use

PtGetResource(*widget,Pt_ARG_AREA,&area,sizeof(PhArea_t))

for example, I get nothing even in case a window is realized already (area members do not change, the function call is 
success).

What am I doing wrong?
Re: Sorry, I am new here: Is there a method to find out window total and client areas?  
Hard to tell what also is wrong by just looking at one line, but this will work:

{
PtWidget_t * widget = ABW_base;
PhArea_t *area;
PtGetResource( widget, Pt_ARG_AREA, &area, 0 );
printf( "area.size.h=%d\n", area->size.h );
}

Here is a link to docs:

http://www.qnx.com/developers/docs/6.4.0/photon/prog_guide/res_code.html
The nature of weirdness...  
The nature of weirdness... Going on:

[code]
PhRect_t		extent;
PtWidget_t	*settings;

PtSetArg(&args[0],Pt_ARG_WINDOW_TITLE,NLS->Title(),0);
PtSetArg(&args[1],Pt_ARG_WINDOW_RENDER_FLAGS,Pt_FALSE,Ph_WM_RENDER_COLLAPSE|Ph_WM_RENDER_MAX|Ph_WM_RENDER_MIN|
Ph_WM_RENDER_MOVE|Ph_WM_RENDER_RESIZE);
PtSetArg(&args[2],Pt_ARG_WINDOW_MANAGED_FLAGS,Pt_FALSE,Ph_WM_COLLAPSE|Ph_WM_MAX|Ph_WM_MENU|Ph_WM_MOVE|Ph_WM_RESIZE);
PtSetArg(&args[3],Pt_ARG_WINDOW_STATE,Pt_TRUE,Ph_WM_STATE_ISMAX);
ZeroMemory(&destroyed,sizeof(PtCallback_t));
destroyed.event_f=&Destroyed;
PtSetArg(&args[4],Pt_CB_DESTROYED,&destroyed,0);
if(!(settings=PtCreateWidget(PtWindow,Pt_NO_PARENT,5,args)))
	throw Status("Create settings window");
PtExtentWidget(settings);	// Should force extent calculation!!! But it doesn't.
PtWidgetExtent(settings,&extent);
[/code]

The settings window being created as maximized with its final dimensions as 1024x768, but the [b]extent[/b] rectangle 
turnes out to be like 0,0,98,22.

What the heck?!
Re: The nature of weirdness...  
A window can't be maximized before it is realized.
If you need to know precisely when the size of a window changes you may want to attach Pt_CB_WINDOW and watch for 
Pt_WM_RESIZE event. I think Pt_CB_RESIZE can be used too.
Re: The nature of weirdness...  
Well, what is the sacred meaning of the PtExtentWidget() existence if it does absolutely nothing?

Because of that I cannot find a way to create a group (PtGroup) with 3 equal sized symmetric buttons inside. The code:

[code]
PtRowLayoutInfo_t	row;

i=0;
PtSetArg(&args[i++],Pt_ARG_GROUP_FLAGS,Pt_TRUE,Pt_GROUP_EQUAL_SIZE); // works
row.type=Pt_LAYOUT_HORIZONTAL; // works
row.flags=Pt_ROW_JUSTIFY; // does not work !!!
row.margin.ul.x=row.margin.ul.y=row.margin.lr.x=row.margin.lr.y=5; // does not work !!!
row.h_spacing=50; // does not work !!!
row.v_spacing=0;
PtSetArg(&args[i++],Pt_ARG_ROW_LAYOUT_INFO,&row,0);
[/code]

produces nothing in common with what was intended...
Re: The nature of weirdness...  
Based on your sample code -- It doesn't work... as expected ;-)
You never set layout type, just the data. PtGroup has its own layout, not PtRawLayout. If read the docs Pt_ARG_LAYOUT is
 not available. I suggest you using PtContainer if you would like to use Pt_ARG_LAYOUT.

Re: The nature of weirdness...  
PtGroup is a direct descendant of PtContainer, so I understand nothing in your words.
Re: The nature of weirdness...  
Wow... Saw nothing more stupid in class inheritance. Those attributes are really blocked in PtGroup.
Re: The nature of weirdness...  
There is a historical reason for that. PtGroup existed long before Pt*Layouts were added to the libph. PtGroup is in its
 own type of layout. We had to block Pt_ARG_LAYOUT on the group to maintain backward compatibility and bahaviour of the 
PtGroup when we added Pt*Layouts to the container class.
Re: The nature of weirdness...  
Sorry, have you blocked all layout functionality from PtScrollContainer as well?

As far as I see, you have, because when I replace any PtScroll* with a PtPane, everything layout related works just fine
, but the container is not the one I need! What the sense of PtScrollArea and PtScrollContainer existence at all then? 
It is impossible to create a dynamic scrollable table at all.
Re: The nature of weirdness...  
And this is the product priced over $8000... Thx god, there is a trial period. God bless M$ again with their CE 6.0 R2..
.