Resize issues, Please Help

Hi.

I hope this is not too vague.

A have a PtRaw widget inside a PtWindow widget. There are also several
other widgets inside the PtWindow widget.

When the user resizes the window, the PtRaw widget also gets resized.

Depending on the new size for the PtRaw widget, I have to allocate some new
buffers and copy the data from old buffers. Then I free the old buffers.

I have a window manager which is trapping the Ph_WM_RESIZE event. This is
where the PtWindow gets resized.

After this, where should I perform the resize for the other widgets inside
the PtWindow widget? The PtRaw widget gets resized by the PtWindow via
anchors to all its sides.

How can I force the resize to occur before the PtRaw draw function gets
called?

How does the resize mechanism work? Is this explain somewhere?

For a resize I would like to do the following things (in this order).

  1. PtWindow gets resized (minimum size enforced, size kept for workspace
    save/restore).
  2. Photon changes the PtWindow size.
  3. PtRaw widget gets resized.
  4. Photon changes the PtRaw widget size.
  5. Get PtRaw widget size (after resize). Allocate/copy/free memory for
    display.
  6. PtRaw Draw() function gets called (once for a full draw after resize).

Is this possible. How is it done?

I have no problems with step 1.

Do I need step 2? Is this a phantom step?

Where do you do step 3? Inside the Window Manager resize?

Do I need step 4? Can I force Photon to update the PtRaw widget size?

Step 5 is not working out. I need to get the PtRaw widget size using
PtBasicWidget(widget, &rect) but the size of the PtRaw widget has not
changed yet. How do I force the PtRaw widget resize?

Step 6 is also a problem. For some reason after a resize there are several
calls to the PtRaw Draw() function. I only need one. Extra calls give me
all sort of problems and I don’t need to be redrawing a complex display
several times.

Please Help.

Thanks.

Augie

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

Augie Henriques wrote:

Hi.

I hope this is not too vague.

A have a PtRaw widget inside a PtWindow widget. There are also several
other widgets inside the PtWindow widget.

When the user resizes the window, the PtRaw widget also gets resized.

Depending on the new size for the PtRaw widget, I have to allocate some
new
buffers and copy the data from old buffers. Then I free the old
buffers.

I have a window manager which is trapping the Ph_WM_RESIZE event. This
is
where the PtWindow gets resized.

After this, where should I perform the resize for the other widgets
inside
the PtWindow widget? The PtRaw widget gets resized by the PtWindow via
anchors to all its sides.

How can I force the resize to occur before the PtRaw draw function gets
called?

How does the resize mechanism work? Is this explain somewhere?

For a resize I would like to do the following things (in this order).

  1. PtWindow gets resized (minimum size enforced, size kept for
    workspace
    save/restore).
  2. Photon changes the PtWindow size.
  3. PtRaw widget gets resized.
  4. Photon changes the PtRaw widget size.
  5. Get PtRaw widget size (after resize). Allocate/copy/free memory for
    display.
  6. PtRaw Draw() function gets called (once for a full draw after
    resize).

Is this possible. How is it done?

I have no problems with step 1.

Do I need step 2? Is this a phantom step?

Where do you do step 3? Inside the Window Manager resize?

Do I need step 4? Can I force Photon to update the PtRaw widget size?

Step 5 is not working out. I need to get the PtRaw widget size using
PtBasicWidget(widget, &rect) but the size of the PtRaw widget has not
changed yet. How do I force the PtRaw widget resize?

Step 6 is also a problem. For some reason after a resize there are
several
calls to the PtRaw Draw() function. I only need one. Extra calls give
me
all sort of problems and I don’t need to be redrawing a complex display
several times.

Please Help.

Thanks.

Augie

Look at “PtGraphic”

I looked at it. How does PtGraphic help me with my resize issue?

Thanks

Augie

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.

I hope this is not too vague.

A have a PtRaw widget inside a PtWindow widget. There are also several
other widgets inside the PtWindow widget.

When the user resizes the window, the PtRaw widget also gets resized.

Depending on the new size for the PtRaw widget, I have to allocate some new
buffers and copy the data from old buffers. Then I free the old buffers.

I have a window manager which is trapping the Ph_WM_RESIZE event. This is
where the PtWindow gets resized.

After this, where should I perform the resize for the other widgets inside
the PtWindow widget? The PtRaw widget gets resized by the PtWindow via
anchors to all its sides.

How can I force the resize to occur before the PtRaw draw function gets
called?

How does the resize mechanism work? Is this explain somewhere?

For a resize I would like to do the following things (in this order).

  1. PtWindow gets resized (minimum size enforced, size kept for workspace
    save/restore).
  2. Photon changes the PtWindow size.
  3. PtRaw widget gets resized.
  4. Photon changes the PtRaw widget size.
  5. Get PtRaw widget size (after resize). Allocate/copy/free memory for
    display.
  6. PtRaw Draw() function gets called (once for a full draw after resize).

Is this possible. How is it done?

I have no problems with step 1.

Do I need step 2? Is this a phantom step?

Where do you do step 3? Inside the Window Manager resize?

Do I need step 4? Can I force Photon to update the PtRaw widget size?

Step 5 is not working out. I need to get the PtRaw widget size using
PtBasicWidget(widget, &rect) but the size of the PtRaw widget has not
changed yet. How do I force the PtRaw widget resize?

Step 6 is also a problem. For some reason after a resize there are several
calls to the PtRaw Draw() function. I only need one. Extra calls give me
all sort of problems and I don’t need to be redrawing a complex display
several times.

Please Help.

Thanks.

Augie

Look at “PtGraphic”


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

I think WeiBing meant that you should construct your drawing with PtGraphic
widgets instead of using the PtRaw. I don’t think though this is what you
want :wink:

As you used anchors, step 1-4 happen automatically. You do not need to take
care of them.

In step 5, unfortunately, there is no resize callback for the PtRaw.
However, you can put the PtRaw inside a PtContainer and attach a resize
callback for the container (Pt_CB_RESIZE). But even easier is to get the
current size in your raw-draw routine, compare it with the previous size,
and if they don’t match, reallocate your memory buffer.

As far as step 6 is concerned, maybe Photon optimizes and does not redraw
the whole widget, if you make the window bigger. Only the new area on the
right and on the bottom gets redrawn (which are two drawn events). You can
force a whole redraw with PtDamageWidget. You would need to call
PtDamageWidget from your resize callback.

Markus



“Augie Henriques” <augiehenriques@hotmail.com> wrote in message
news:95sg1q$7fr$1@inn.qnx.com

“WeiBing Tong” <> wbtong@aquilamsl.com> > wrote in message
news:> 3A81C38F.FDAF8047@aquilamsl.com> …
Augie Henriques wrote:

Hi.

I hope this is not too vague.

A have a PtRaw widget inside a PtWindow widget. There are also
several
other widgets inside the PtWindow widget.

When the user resizes the window, the PtRaw widget also gets resized.

Depending on the new size for the PtRaw widget, I have to allocate
some
new
buffers and copy the data from old buffers. Then I free the old
buffers.

I have a window manager which is trapping the Ph_WM_RESIZE event.
This
is
where the PtWindow gets resized.

After this, where should I perform the resize for the other widgets
inside
the PtWindow widget? The PtRaw widget gets resized by the PtWindow
via
anchors to all its sides.

How can I force the resize to occur before the PtRaw draw function
gets
called?

How does the resize mechanism work? Is this explain somewhere?

For a resize I would like to do the following things (in this order).

  1. PtWindow gets resized (minimum size enforced, size kept for
    workspace
    save/restore).
  2. Photon changes the PtWindow size.
  3. PtRaw widget gets resized.
  4. Photon changes the PtRaw widget size.
  5. Get PtRaw widget size (after resize). Allocate/copy/free memory
    for
    display.
  6. PtRaw Draw() function gets called (once for a full draw after
    resize).

Is this possible. How is it done?

I have no problems with step 1.

Do I need step 2? Is this a phantom step?

Where do you do step 3? Inside the Window Manager resize?

Do I need step 4? Can I force Photon to update the PtRaw widget size?

Step 5 is not working out. I need to get the PtRaw widget size using
PtBasicWidget(widget, &rect) but the size of the PtRaw widget has not
changed yet. How do I force the PtRaw widget resize?

Step 6 is also a problem. For some reason after a resize there are
several
calls to the PtRaw Draw() function. I only need one. Extra calls
give
me
all sort of problems and I don’t need to be redrawing a complex
display
several times.

Please Help.

Thanks.

Augie

Look at “PtGraphic”

I looked at it. How does PtGraphic help me with my resize issue?

Thanks

Augie



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

\