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
[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 - UIColor usage

UIColor usage

A PocketC native palm library offering native forms and assorted utilities

Postby dcalp on Sat Sep 14, 2002 12:27 pm

What's wrong with this code?
All push buttons are filled in olive green,
the color of the last button.
Tested in Emulator with PalmOS 3.5 color ROM
Thanks


//UIColor test
library "PToolboxLib"
#include "Fctl.h"

#define Fm1 3000
#define Pb2 3001
#define Pb3 3002
#define Pb4 3003
#define Pb5 3004

main(){
int e;
SetDepth(5);

Form(Fm1,"Fm1");
UIColor(1,0);
Button(Pb2,0x001,5,21,42,13,"0");

UIColor(1,1);
Button(Pb3,0x001,5,41,42,13,"1");

UIColor(1,2);
Button(Pb4,0x001,5,61,42,13,"2");

UIColor(1,3);
Button(Pb5,0x001,5,81,42,13,"3");

Fctl(DRAW,Fm1);

while(1){
e=Fevent(1);
}
}

DC

Pocket VisualForms
Visual design for PocketC
http://pocketvf.port5.com
http://www.angelfire.com/rnb/pocketvf
Diego

Pocket VisualForms
Visual design for PocketC
http://www.diegocalp.com.ar
dcalp
 
Posts: 115
Joined: Thu Dec 06, 2001 9:53 am
Location: Argentina

Postby jstadolnik on Sun Sep 15, 2002 2:12 am

The palmOS does not keep track of the color of individual form objects. Thus in your example, the last UIColor(1,x) call before the Fctl DRAW will take precendence. When the DRAW occurs, all the objects get drawn according to the system color settings (which UIColor gives control over). This is just way the palm OS works.

The best way to handle buttons of different colors is to use graphical buttons (see the GButton() function).

Another approach which I've seen people do, which is clever, but not as clean, is demonstrated in the code below.

Joe

------------

//ButtonColor.c
library "PToolboxLib"
#include "Fctl.h"

#define Fm1 3000
#define Pb2 3001
#define Pb3 3002
#define Pb4 3003
#define Pb5 3004

buttonColor(int id, int color) {
UIColor(1,color);
Fctl(SHOW,id);
}

main(){
int e;
SetDepth(5);

Form(Fm1,"Fm1");
Button(Pb2,0x001,5,21,42,13,"0");
Button(Pb3,0x001,5,41,42,13,"1");
Button(Pb4,0x001,5,61,42,13,"2");
Button(Pb5,0x001,5,81,42,13,"3");

Fctl(DRAW,Fm1);

//update individual button colors after the DRAW
buttonColor(Pb2,0);
buttonColor(Pb3,1);
buttonColor(Pb4,2);
buttonColor(Pb5,4);

while(1) {
e=Fevent(1);
switch(e) {
case Pb2: buttonColor(e, 0); break; //need to restore the old colors
case Pb3: buttonColor(e, 1); break;
case Pb4: buttonColor(e, 2); break;
case Pb5: buttonColor(e, 4); break;
}
}
}

The PToolboxLib guy.
http://www.geocities.com/retro_01775/PToolboxLib.htm
jstadolnik
 
Posts: 1741
Joined: Wed Dec 06, 2000 3:34 am
Location: USA

Postby dcalp on Sun Sep 15, 2002 9:27 am

Joe:
Always helpful, thank you very much



DC

Pocket VisualForms
Visual design for PocketC
http://pocketvf.port5.com
http://www.angelfire.com/rnb/pocketvf
Diego

Pocket VisualForms
Visual design for PocketC
http://www.diegocalp.com.ar
dcalp
 
Posts: 115
Joined: Thu Dec 06, 2001 9:53 am
Location: Argentina

Postby Dman on Sun Nov 24, 2002 6:21 am

And if you want to do more colors than black and white, do you put hex numbers in for the color or does it just go 1-256, 1-65,000?


big brother is watching
----[self-mutilation or self-empowerment?]----
Dman
 
Posts: 128
Joined: Mon Jul 02, 2001 8:08 pm
Location: USA

Postby Dman on Sun Nov 24, 2002 6:27 am

also, I'm trying to use the above example by joe and even just puttin UIColor above each button, I'm trying to use these in high-res on an NR70v, but I get a fatal exception every time I put anything to do with UIColor in. Is it compatible with high-res? I'd really rather do it like this if possible, since it'd be a pain to make a graphical button for each button, since I have 26 buttons on this form....

big brother is watching
----[self-mutilation or self-empowerment?]----
Dman
 
Posts: 128
Joined: Mon Jul 02, 2001 8:08 pm
Location: USA

Postby jstadolnik on Sun Nov 24, 2002 2:27 pm

I've tested it in hi-res on a T615 rom and it works fine. You likely have a bug in your code. The code I used was identical to Diego's except I put a Sony(1,1) before the SetDepth() call.

I would suggest using PVF to this, Diego has worked out the complications which arise when coloring buttons in the fashion.

Joe

The PToolboxLib guy.
http://www.geocities.com/retro_01775/PToolboxLib.htm
jstadolnik
 
Posts: 1741
Joined: Wed Dec 06, 2000 3:34 am
Location: USA

Postby Dman on Sun Nov 24, 2002 7:37 pm

hah, remember how I mentioned a severe lack of sleep in the menu controls thread? well your mention of setdepth just made me realize I forgot to do that :x sorry for bothering you about that. and being away from this forum for so long, i don't know what you mean by PVF, I'm assuming this is another library? suppose I should go search for it eh? *L* thanks for your help man

big brother is watching
----[self-mutilation or self-empowerment?]----
Dman
 
Posts: 128
Joined: Mon Jul 02, 2001 8:08 pm
Location: USA

Postby jstadolnik on Mon Nov 25, 2002 4:33 pm

You can find the link to Pocket VisualForms on the PocketC resources page, which you get to through the PocketC link on the Orbworks main page.

Joe

BTW: You did uncover a slight bug. UIColor shouldn't be crashing on you if the screen depth wasn't set correctly. I've already fixed this for v7.5.1.



The PToolboxLib guy.
http://www.geocities.com/retro_01775/PToolboxLib.htm
jstadolnik
 
Posts: 1741
Joined: Wed Dec 06, 2000 3:34 am
Location: USA


Return to Pocket Toolbox

Who is online

Users browsing this forum: No registered users and 1 guest

cron