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

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

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

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

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

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

EDIT box

Discuss PocketC for CE (including Desktop Edition)

Postby daparty on Wed Mar 17, 2004 10:57 pm

I'm new to PocketC (2.0) and have a question about an Edit box. How do I highlight the information in an EDIT box so that the information is showing as inverse and clears itself when new information is entered. This is similar to having information in the Edit box and double tapping it to highlight what's there before entering new information. I don't want to double tap the screen, but have the program do it after I act on the input and have the old information still showing as inverse and ready to accept any new input.

I just got an HP Jornada 547 to play with and found PocketC when doing a search for information about the Jornada. Now I'm more interested in programming it then using the other programs that are already on it. From the information I've found, apparently I'm a few years past the high point of PocketC.:(

I have a 256 meg compact flash card for a digital camera that works just fine in the Jornada. I use the compact flash for MP3 files and to transfer information when I don't want to use the active sync software. When I want to use the card in the camera again, I'll just copy the card to my PC.

Thanks,
Dave.
daparty
 
Posts: 7
Joined: Mon Mar 08, 2004 11:44 pm

Postby wolfgang on Fri Mar 19, 2004 3:06 pm

Hi,

I'm writing the following from memory (have to wait to get home tonight before I can check in my PocketC code base):

To highlight a portion of the text displayed in the edit box, send a message to to control ID of the edit box (MY_CTRL_ID):

sendmsg (MY_CTRL_ID, EM_SETSEL, startpos, endpos);

startpos and endpos are the first and last character position you want to highlight. The position numbering starts from 0. If your editbox contains "Hello" (length 5) and you want to highlight the whole word, set startpos to 0 and endpos to 4.

To get the length of what is in the edit box and highlight it, use:

string s;
int len;

s = editget (MY_CTRL_ID);
len = strlen (s);
sendmsg (MY_CTRL_ID, EM_SETSEL, 0, len - 1);

That was for clarity; of course you can write all that much more compact as:

sendmsg (MY_CTRL_ID, EM_SETSEL, 0, strlen (editget (MY_CTRL_ID)) - 1);

If it does not work as described above, drop me a note (wolfgang@pdamusician.com) and I look it up in my code (my program MidNote uses it, so I know it works somehow).

Wolfgang


Composing music on the PocketPC! - http://www.pdamusician.com
Composing music on the PocketPC! - http://www.pdamusician.com
wolfgang
 
Posts: 281
Joined: Tue Dec 12, 2000 4:22 am
Location: USA

Postby wolfgang on Fri Mar 19, 2004 3:14 pm

I think you also need to set the focus to the editbox after you selected the text:

guisetfocus (MY_CTRL_ID);

Wolfgang


Composing music on the PocketPC! - http://www.pdamusician.com
Composing music on the PocketPC! - http://www.pdamusician.com
wolfgang
 
Posts: 281
Joined: Tue Dec 12, 2000 4:22 am
Location: USA

Postby daparty on Fri Mar 19, 2004 11:09 pm

Thanks Wolfgang :), thats exactly what I was looking for.

I had a little problem with EM_SETSEL since it isn't
defined in the pcheader.h file. I did a search and ended
up on Microsofts page where I found all sorts of information
on different functions. I found that EM_SETSEL is
defined as 0x00b1.

Thanks again,

Dave
daparty
 
Posts: 7
Joined: Mon Mar 08, 2004 11:44 pm

Postby wolfgang on Sat Mar 20, 2004 3:02 pm

EM_SETSEL (and a lot of other constants that are useful in PocketC) is defined in the file windefs.h, which is part of PCFOrm. Download the demo version of PCForm from http://www.pcform.net.

Wolfgang


Composing music on the PocketPC! - http://www.pdamusician.com
Composing music on the PocketPC! - http://www.pdamusician.com
wolfgang
 
Posts: 281
Joined: Tue Dec 12, 2000 4:22 am
Location: USA

Postby wolfgang on Sat Mar 20, 2004 3:03 pm

I checked my code at home, and it looks like the sendmsg() call is slightly different:

sendmsg (MY_CTRL_ID, EM_SETSEL, startpos, len);

i.e. for your case

sendmsg (MY_CTRL_ID, EM_SETSEL, 0, strlen(editget(MY_CTRL_ID)));

By the way, editset() can be used to change the label of any control (most important labels, command buttons and check boxes), not just the text of edit boxes.

For more information about GUI and controls go to http://www.pcform.net. Download the demo version of PCForm, it contains a pretty good description of all the controls and what you can do with each of them. In addition, create some small program with PCForm and look at the PocketC code it produces, that gives you some good ideas (I learned a lot by doing that), epecially regarding event handling and all the different options for the different controls.

Two files you will find helpful: windefs.h and pcheader.h (the first comes with PocketC, the second comes with PCForm). They contain (almost) all the constants for sendmsg and createctrl you can use, and I browsed them when I wanted to find some specific functions.


Composing music on the PocketPC! - http://www.pdamusician.com
Composing music on the PocketPC! - http://www.pdamusician.com
wolfgang
 
Posts: 281
Joined: Tue Dec 12, 2000 4:22 am
Location: USA


Return to PocketC for CE

Who is online

Users browsing this forum: No registered users and 3 guests

cron