Snippit from Palm OS Programming for Dummies example:


#define Main_Form       1000    // Identifier for dynamic Form and Form
elements

//
// Create the main form dynamically
//
static void MakeMainForm(void)
{
        FormPtr newForm;
        EventType openEvent;
        
        newForm = FrmNewForm(Main_Form, "Tester", 0, 0, 160, 160, false,
                0, 0, Main_MenuBar);
        
        FrmSetActiveForm(newForm);
        FrmSetEventHandler(newForm, MainFormHandleEvent);
        // add dynamic interface elements
        CtlNewControl ((VoidPtr) &newForm, Main_Form+1, buttonCtl, 
                                "Next", 
                                20, 145, 40, 14, stdFont, 0, true);
        CtlNewControl ((VoidPtr) &newForm, Main_Form+2, buttonCtl, 
                                "Previous", 
                                100, 145, 40, 14, stdFont, 0, true);
        // generate event
        openEvent.eType = frmOpenEvent;
        openEvent.data.frmOpen.formID = Main_Form;
        EvtAddEventToQueue (&openEvent);
}

This example does more than you need, making a form and buttons, but you get
the idea... just be sure to give new buttons an Id.

In your form handler, you'll need to use:
        case ctlSelectEvent:
                switch(event->data.ctlSelect.controlID) {
                        case Main_Form+1:
                                break;
                        case Main_Form+2:
                                break;
                }

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

-----Original Message-----
From: Noah J. Ternullo
To: Palm Developer Forum
Sent: 3/16/00 2:33 PM
Subject: Dynamic Button Creation Crazyness...

Howdy all, 
        I can create dynamic buttons.  I can even see them.  I don't
seem
to be able to click on them though (meaning, they don't invert like the
buttons you build in Code Warrior's constructor do.).

        Do I need to do something special to be able to use dynamically
created buttons?

        Noah Ternullo

------------------------------------------------------------------------
--------
Noah J. Ternullo                                [EMAIL PROTECTED]
------------------------------------------------------------------------
--------
"As a matter of constitutional tradition, in the absence of evidence to
the 
contrary, we presume that governmental regulation of the content of
speech
is more likely to interfere with the free exchange of ideas than to
encourage it."                  - Supreme Court Justice John Paul
Stevens 
------------------------------------------------------------------------
--------


-- 
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