Restore minimized window state on open

Hi.

In my Photon App I keep the positions for all display windows. When I
window is opened it gets its position restore.

If the window was closed the window setup function returns Pt_HALT. This
correctly creates the window, but does not open it.

I also need to keep the minimized state for the window. How is this done?

I have tried to set the Pt_ARG_WINDOW_STATE to Ph_WM_STATE_ISHIDDEN inside
the setup function, but the window always comes up normal.

What is the difference between Ph_WM_STATE_ISHIDDEN and
Ph_WM_STATE_ISICONFIED?

Thanks,

Augie

“WeiBing Tong” <wbtong@aquilamsl.com> wrote in message
news:3A81C2DE.54269F7D@aquilamsl.com

Augie Henriques wrote:

Hi.

In my Photon App I keep the positions for all display windows. When I
window is opened it gets its position restore.

If the window was closed the window setup function returns Pt_HALT.
This
correctly creates the window, but does not open it.

I also need to keep the minimized state for the window. How is this
done?

I have tried to set the Pt_ARG_WINDOW_STATE to Ph_WM_STATE_ISHIDDEN
inside
the setup function, but the window always comes up normal.

What is the difference between Ph_WM_STATE_ISHIDDEN and
Ph_WM_STATE_ISICONFIED?

Thanks,

Augie

Correctly set your windows’ Pt_ARG_WINDOW_MANAGED_FLAGS, if you want to
control your window
state, please use PtForwardWindowEvent(). The Pt_ARG_WINDOW_STATE setting
only
effect when your window is realized.

What controls the the minimizing? Ph_WM_STATE_ISHIDDEN or
Ph_WM_STATE_ISICONIFIED?

The docs say that if you set the Ph_WM_STATE_* before the widget is realized
that it should come up correctly. Is this wrong?

Which Pt_ARG_WINDOW_MANAGED_FLAGS do I need to set for minimizing?

Thanks again,

Augie

For example:

If you want your window to be front, specify Pt_ARG_WINDOW_MANAGED_FLAGS
resoure with
Ph_WM_TOFRONT,

In your code,

PhWindowEvent_t Event;
memset( &Event, 0, sizeof( Event) );
Event.event_f = Ph_WM_TOFRONT;
PtForwardWindowEvent(&Event );

Then your window will be in front.

Regards


WeiBing Tong

Aquila Mining Systems Ltd.
1450 City Councillors, Suite 330
Montreal, QC
Canada H3A 2E6
Tel: (514) 874-9917 ext 239
Fax: (514) 874-4005
Email: > wbtong@aquilamsl.com

Augie Henriques wrote:

Hi.

In my Photon App I keep the positions for all display windows. When I
window is opened it gets its position restore.

If the window was closed the window setup function returns Pt_HALT. This
correctly creates the window, but does not open it.

I also need to keep the minimized state for the window. How is this done?

I have tried to set the Pt_ARG_WINDOW_STATE to Ph_WM_STATE_ISHIDDEN inside
the setup function, but the window always comes up normal.

What is the difference between Ph_WM_STATE_ISHIDDEN and
Ph_WM_STATE_ISICONFIED?

Thanks,

Augie

Correctly set your windows’ Pt_ARG_WINDOW_MANAGED_FLAGS, if you want to
control your window
state, please use PtForwardWindowEvent(). The Pt_ARG_WINDOW_STATE setting only
effect when your window is realized.

For example:

If you want your window to be front, specify Pt_ARG_WINDOW_MANAGED_FLAGS
resoure with
Ph_WM_TOFRONT,

In your code,

PhWindowEvent_t Event;
memset( &Event, 0, sizeof( Event) );
Event.event_f = Ph_WM_TOFRONT;
PtForwardWindowEvent(&Event );

Then your window will be in front.

Regards


WeiBing Tong

Aquila Mining Systems Ltd.
1450 City Councillors, Suite 330
Montreal, QC
Canada H3A 2E6
Tel: (514) 874-9917 ext 239
Fax: (514) 874-4005
Email: wbtong@aquilamsl.com

What controls the the minimizing? Ph_WM_STATE_ISHIDDEN or
Ph_WM_STATE_ISICONIFIED?

The docs say that if you set the Ph_WM_STATE_* before the widget is realized
that it should come up correctly. Is this wrong?

Which Pt_ARG_WINDOW_MANAGED_FLAGS do I need to set for minimizing?

(1) I just try it on Photon1.14, you can set Pt_ARG_WINDOW_STATE as
Ph_WM_STATE_ISHIDDEN or Ph_WM_STATE_ISICON.

(2) You can set Pt_ARG_WINDOW_STATE as Ph_WM_STATE_ISNORMAL
(default), when you lanch your program, add an option like: Test -Si.

(3) When you want to control your window state in your code, use
PtForwardWindowEvent().

(4) When you want to control your window state from other process, use
PtForwardWindowTaskEvent().

(5) When you want to check your window state, do not use PtGetResources() to get
Pt_ARG_WINDOW_STATE
resources, use PtWindowgetState() instead. This is against those Docs.

Hope this is helpful for you!

Regards


WeiBing Tong

Aquila Mining Systems Ltd.
1450 City Councillors, Suite 330
Montreal, QC
Canada H3A 2E6
Tel: (514) 874-9917 ext 239
Fax: (514) 874-4005
Email: wbtong@aquilamsl.com

“WeiBing Tong” <wbtong@aquilamsl.com> wrote in message
news:3A82A9BB.FF953456@aquilamsl.com

What controls the the minimizing? Ph_WM_STATE_ISHIDDEN or
Ph_WM_STATE_ISICONIFIED?

The docs say that if you set the Ph_WM_STATE_* before the widget is
realized
that it should come up correctly. Is this wrong?

Which Pt_ARG_WINDOW_MANAGED_FLAGS do I need to set for minimizing?

Thanks for the reply.

(1) I just try it on Photon1.14, you can set Pt_ARG_WINDOW_STATE as
Ph_WM_STATE_ISHIDDEN or Ph_WM_STATE_ISICON.

Yes. I also have tried this and it works.

But this is not exactly what I’m trying to do. I would like to set the
Pt_ARG_WINDOW_STATE flags inside the Window Setup function, before the
window is realized. This is where I have the problem. If a window is
minimized on exit, my App has to have the window minimized when the App is
started again.

It seems something in Photon is changing the Pt_ARG_WINDOW_STATE flag back
to Ph_WM_STATE_ISNORMAL and then my window does not come up minimized as
desired. Why?

When I set the Ph_WM_STATE_ISHIDDEN or Ph_WM_STATE_ISICON in Phab, then the
window is minimized. I want to leave the window as Ph_WM_STATE_ISNORMAL and
then change the Pt_ARG_WINDOW_STATE inside the window setup function if the
window is to be minimized.

Why do we need to flags (Ph_WM_STATE_ISICON and Ph_WM_STATE_ISHIDDEN)?

Augie

(2) You can set Pt_ARG_WINDOW_STATE as Ph_WM_STATE_ISNORMAL
(default), when you lanch your program, add an option like: Test -Si.

(3) When you want to control your window state in your code, use
PtForwardWindowEvent().

(4) When you want to control your window state from other process, use
PtForwardWindowTaskEvent().

(5) When you want to check your window state, do not use PtGetResources()
to get
Pt_ARG_WINDOW_STATE
resources, use PtWindowgetState() instead. This is against those Docs.

Hope this is helpful for you!

Regards


WeiBing Tong

Aquila Mining Systems Ltd.
1450 City Councillors, Suite 330
Montreal, QC
Canada H3A 2E6
Tel: (514) 874-9917 ext 239
Fax: (514) 874-4005
Email: > wbtong@aquilamsl.com