What is the general strategy for repositioning controls on a form when the
Sony software silkscreen area is shown or hidden?

I am using the following method, but am not having success.

I'm using CW9 and the Sony 5.0 SDK (which is not the version included with
CW9) and testing on an NX60.  In order to try to grasp the implications of
handling the software graffiti area, I'm attempting to add support for the
software silkscreen to a very simple app that consists of one form with
three buttons across the bottom of the form.  When the software silkscreen
is closed, I want to move the buttons so that they are still at the bottom
of the form.

I have initialized the library and registered the notification, and am
receiving sysNotifyDisplayChangeEvent as expected.  However, I am unable to
successfully reposition these controls on the form.  I'm finding that when
reposition the control to a point "below" the normal 160x160 position, the
control is not shown.

Upon receiving sysNotifyDisplayChangeEvent and verifying that my app is also
the running app, I simply call FrmUpdateForm() as a quick means of
communicating to my form that it needs to change.  Here is how I handle the
frmUpdateEvent.

    case frmUpdateEvent:
        
        {
        MainFormPositionControls();
        FrmDrawForm(FrmGetFormPtr(MainForm));
        return true;
        }
                        
And here is the MainFormPositionControls function that is called.  I use
MainFormPositionControls when initializing my form, and also during a
frmUpdateEvent.
�
static void MainFormPositionControls(void)
    {
    Int16 x = 0;              // width of window
    Int16 y = 0;              // height of window
    RectangleType bounds;     // bounds of control
    FormType * pForm = NULL;  // active form
    UInt16 index = 0;         // index of item on form
    Int16 i = 0;              // loop counter
    Int16 gutter = 3;         // gutter size
        
    static UInt16 ids[] = 
        {
        MainResetButton,
        MainHelpButton,
        MainAboutButton
        };
                
    pForm = FrmGetActiveForm();
    ASSERT(pForm != NULL);
        
    WinGetDisplayExtent(&x, &y);
        
    for (i = 0; i < 3; i++)
        {
        index = FrmGetObjectIndex(pForm, ids[i]);
        FrmGetObjectBounds(pForm, index, &bounds);
        FrmSetObjectPosition(
          pForm, 
          index, 
          bounds.topLeft.x,
          y - bounds.extent.y - gutter);
        }
    }

The x and y display extent is as expected: x = 160, y = 225.

The repositioned y is calculated to be 210, which is correct.  The form is
drawn AFTER the change, so the buttons should show up at the bottom of the
taller form.  Alas, however, they don't show up at all.

Any advice would be appreciated.



--
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to