An excerpt from my "Palm OS Programming for Dummies" example in  chapter 15
on dynamic interfaces:
#define Main_Form       1000    // Identifier for dynamic Form and Form
elements

        Word id;
        FormPtr frm;
        Word firstIndex;                                // index of the
first dynamic Form element

        // make one (or more) push buttons

        frm = FrmGetActiveForm();
        firstIndex = FrmGetNumberOfObjects(frm);        // remember where
we're starting
        id = Main_Form+firstIndex+1;                    // Main_Form should
be a number sufficiently large to avoid overlap 
                                                                // with all
ctrl ids in the current form  

        CtlNewControl ((VoidPtr) &frm, id++, pushButtonCtl,
                                "button label", 60, 125, 10, 11, boldFont,
1, true);

        // make more if needed


You'll want to keep track of the control id(s) you assign to the dynamic
buttons, so you'll be able to properly handle them in your form event
handler. You'll get a ctlSelectEvent with the data.ctlSelect.controlID value
equal to whatever you used in the CtlNewControl() call. 

- John Schettino
Palm OS Programming for Dummies http://schettino.tripod.com

-----Original Message-----
From: McMicken, Steven [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 22, 2000 1:05 PM
To: Palm Developer Forum
Subject: RE: Dynamic pushbuttons


I'm working on it, too.  The code doesn't work yet, but I know that you use
CtlNewControl.

Regards,

Steve

> -----Original Message-----
> From: McCollister, Mike [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, February 22, 2000 3:55 PM
> To: Palm Developer Forum
> Subject: Dynamic pushbuttons
> 
> 
> Hi,
> 
> I am trying to figure out how to dynamically change 
> (add/remove) pushbuttons
> on my form. Does anyone have any sample code that I can view?
> 
> Thanks,
> 
> Mike McCollister
> 
> -- 
> For information on using the Palm Developer Forums, or to 
> unsubscribe, please see http://www.palm.com/devzone/mailinglists.html
> 
> 

-- 
For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palm.com/devzone/mailinglists.html

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palm.com/devzone/mailinglists.html

Reply via email to