onselect button not responding

Discuss OrbForms Designer and PocketC Architect

Postby Gazza on Sat Apr 26, 2003 11:45 pm

I am programming a simple metronome
Once the loop is running cmdBegin button won't respond

Any help appreciated.

My palm emulator is 3.0a8

Thanks in Advance Gee.

// mainform.oc

int flag;

void loop_ticks()
{
int get_ticks;
int cnt;
int freq[4] = {880,440,400,400};

get_ticks = ticks();

while(cmdBegin.text = "Stop")
{
for(cnt=0;cnt<4;)
{
if (ticks()-get_ticks == (6000/60))
{
tonea(freq[cnt],20,60);
get_ticks = ticks();
cnt++;
}
}
cnt = 0;
}
}
handler mainForm.onopen()
{
frmSplash.domodal();
flag = 0;
}

handler mainOptionsAbout.onselect() {
alert("This is an OrbForms Designer Application");
}

handler cmdBegin.onselect()
{
flag = flag + 1;

if (flag == 1)
{
cmdBegin.text = "Stop";
loop_ticks();
}

if (flag == 2)
{
cmdBegin.text = "Begin";
flag = 0;
}
}
Gazza
 
Posts: 146
Joined: Sat Jan 12, 2002 1:56 am
Location: United Kingdom

Postby dewey on Sun Apr 27, 2003 2:15 pm

Only one event can be processed at a time, since the Palm is a single threaded environment. Therefore, until your complete the loop, no other events will be handled.

In the next version, I will be adding a method to allow events to be handled during lenghty operations like this. In the mean time, you need to use a timer to do this. Create a timer in your form, and do part of your "processing" each time it fires.
dewey
Site Admin
 
Posts: 749
Joined: Sun Oct 21, 2007 5:12 am


Return to OrbForms Designer and PocketC Architect

Who is online

Users browsing this forum: No registered users and 3 guests

cron