Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 112
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3368: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3370: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3371: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3372: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
OrbWorks Community Forum • View topic - UIList.setdrawfunc() working as intended?

UIList.setdrawfunc() working as intended?

Discuss OrbForms Designer and PocketC Architect

Postby FlashBIOS on Wed Jan 04, 2006 12:24 am

Hello all,

In an attempt to make a "table" out of the UIList, I followed the example in the Help document (see below for reference).

The example is either outdated, or I am not following it correctly. When implemented as in the example, I get a runtime error about not being able to use the setdrawfunc in the form's onopen because it draws.

No problem, I thought, I would move setdrawfunc() to the form's ondraw. However, that doesn't appear to work as hoped. The list will populate as per setitems(), but without utilizing setdrawfunc(). Only when I click on an item in list, it will redraw with the setdrawfunc() when coded like this.

Now, I have "solved" the problem by moving somethings around and calling redraw() in the onopen. This, of course, is less than ideal, but not deal breaking. However, that leads me to my question -- is setdrawfunc() working as intended (and I'm doing something wrong)? Or has something changed? A quick search through the forms didn't give me any clues.

Thanks for your help.

<hr noshade size="1">
void drawColorList(int item, int x, int y, int w, int h, string text);
string colorNames[3] = { "red", "green", "blue" };
int colorRed[3] = { 255, 0, 0 };
int colorGreen[3] = { 0, 255, 0 };
int colorBlue[3] = { 0, 0, 255 };

Draw draw;
handler mainform.onopen() {
draw.attachForm(this);
listColor.setitems(3, colorNames);
listColor.setdrawfunc(drawColorList);
}

void drawColorList(int item, int x, int y, int w, int h, string text) {
draw.begin();
draw.textTrunc(x + 12, y, w - 12, text);
draw.fgRGB(colorRed[item], colorGreen[item], colorBlue[item]);
draw.rect(clrFG, x, y+1, x+9, y+10, 0);
draw.end();
}
<hr noshade size="1">
FlashBIOS
 
Posts: 6
Joined: Sun Jan 01, 2006 5:22 am

Postby dewey on Wed Jan 04, 2006 4:05 am

You can and should call setdrawfunc in the onopen handler. The error you mentioned is only generated when Draw.begin/nbegin is called in onopen. If you are calling redraw() in onopen (which you should not do), this will cause your custom drawing function to be called.
dewey
Site Admin
 
Posts: 749
Joined: Sun Oct 21, 2007 5:12 am

Postby FlashBIOS on Thu Jan 05, 2006 8:47 pm

<blockquote id="quote"><font size="1" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote"><i>Originally posted by dewey</i>
<br />You can and should call setdrawfunc in the onopen handler. The error you mentioned is only generated when Draw.begin/nbegin is called in onopen. If you are calling redraw() in onopen (which you should not do), this will cause your custom drawing function to be called.
<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">

Good, I am glad that I was at least thinking correctly. However, when trying to implement the simple example in the Help docs, I do still get that error when I have setdrawfunc() in the onopen. Clearly, there must be something strange going on. I've created a barebones project, where I've simply cut-and-pasted the Help doc's code.

You can view a JPEG of the error here:
<http://cc.minnesota.edu/~cgoltz/drawerrorcap.jpg>,
and download the test project itself here:
<http://cc.minnesota.edu/~cgoltz/setDrawFuncTest.zip>

Again, thank you for your assistance.
FlashBIOS
 
Posts: 6
Joined: Sun Jan 01, 2006 5:22 am

Postby nmc on Thu Jan 05, 2006 9:33 pm

try to do the setitems() call via timer-event (so, outside of onopen())
nmc
 
Posts: 197
Joined: Tue May 27, 2003 8:42 pm
Location: Germany

Postby FlashBIOS on Thu Jan 05, 2006 9:47 pm

<blockquote id="quote"><font size="1" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote"><i>Originally posted by nmc</i>
<br />try to do the setitems() call via timer-event (so, outside of onopen())
<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">

Ah, interesting work-around. I'll try that in place of the redraw() until I can figure out why the Help doc's code isn't working. Thanks.
FlashBIOS
 
Posts: 6
Joined: Sun Jan 01, 2006 5:22 am

Postby FlashBIOS on Mon Jan 09, 2006 6:57 pm

<blockquote id="quote"><font size="1" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote"><i>Originally posted by dewey</i>
<br />You can and should call setdrawfunc in the onopen handler. The error you mentioned is only generated when Draw.begin/nbegin is called in onopen. If you are calling redraw() in onopen (which you should not do), this will cause your custom drawing function to be called.
<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">

I am still trying to get it to work this way. I still have the errors that my sample project (posted above) are generating, despite the Help docs (and Dewy's) statements saying that it should.

Could anyone be so kind as to tell me what is going wrong, or let me know if they are getting the same error?

Thank you all.
FlashBIOS
 
Posts: 6
Joined: Sun Jan 01, 2006 5:22 am

Postby dewey on Tue Jan 10, 2006 2:22 am

Can you send me your project (dewey@orbworks)? I'll take a look at it here sometime this week.
dewey
Site Admin
 
Posts: 749
Joined: Sun Oct 21, 2007 5:12 am

Postby dewey on Thu Jan 12, 2006 6:37 am

This is a bug in the runtime, where it is thinking the onopen handler is still running when it asks the OS to draw the form. A workaround until I can fix/release this is to change the code to register the custom draw function and redraw the first time the form is drawn:

Code: Select all
Draw draw;
bool setCustom = false;
handler mainForm.onopen() {
  draw.attachForm(this);
  listColor.setitems(3, colorNames);
}

handler mainForm.ondraw() {
  if (!setCustom) {
    listColor.setdrawfunc(drawColorList);
    listColor.redraw();
    setCustom = true;
  }
}

handler mainForm.onclose() {
  setCustom = false;
}
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 1 guest

cron