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 - setting date picker

setting date picker

Discuss PocketC for CE (including Desktop Edition)

Postby bvinas on Sat Mar 17, 2001 11:16 am

Hey everyone,

I can get the selected date from a date picker control using editget, but I can not set the initial value of a date picker. editset does not work. Any suggestions?

Bobby
bvinas
 
Posts: 43
Joined: Mon Feb 12, 2001 8:15 pm
Location: USA

Postby guy on Sat Mar 17, 2001 2:59 pm

You can't do it. It requires enhancements to the way that PocketC interacts with the windows messaging subsystem.

You have to send a DTM_SETSYSTEMTIME message to the control to set the initial time.

The lparam parameter on this message is a pointer to a SYSTEMTIME structure.

You can't pass structures or pointer to structures to sendmsg() in PocketC. So you're stuck.

Unless:

1. It isn't Sunday, and
2. It isn't between midnight and 1AM, and
3. It isn't exactly on the hour

Then you can do this:

<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
string tBigFudge;
int iYear ;
int iMonth ;
int iDay ;
int iDayOfWeek;
int iHour ;
int iMinute ;
int iSecond ;
int iMillisecond ;

iYear = 2001 ;
iMonth = 3 ; // 1=Jan, 2=Feb...
iDay = 17 ; // Today
iDayOfWeek = 6 ; // Saturday. 0 is Sunday, can't use 0
iHour = 16 ; // 4PM
iMinute = 45 ; // Can't use exactly on the hour (=0)
iSecond = 1 ; // Just don't use 0
iMillisecond = 1 ; // Don't use 0

// Attempt to build a SYSTEMTIME structure in a string.
// Note that the web board removes all the plus signs below, so I'm using the word "plus" instead.

tBigFudge = "" plus (char) iYear plus (char) iMonth plus (char) iDayOfWeek plus (char) iDay plus (char) iHour plus (char) iMinute plus (char) iSecond plus (char) iMillisecond ;

sendmsg(CTL_DATETIME1, 0, tBigFudge) ;

// The above may actually work if you're really lucky.
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>





Guy
Guy
[url]mailto:pcform@pcform.net[/url]
http://www.pcform.net
PocketC CE API interface: http://www.networkdynamics.net/PCForm.html#library
PCForm and CE API forum: http://www.networkdynamics.net/forum
guy
 
Posts: 879
Joined: Thu Dec 07, 2000 8:58 am
Location: United Kingdom

Postby bvinas on Sat Mar 17, 2001 4:51 pm

Thanks Guy, I'll give it a try.

bobby
bvinas
 
Posts: 43
Joined: Mon Feb 12, 2001 8:15 pm
Location: USA

Postby Admin on Fri Mar 30, 2001 4:23 am

That is not the end of world. Someone can always wrap these features into an API that sit inside of an external dll. There could be one dll that contain all of the popular controls and their creation and message handling etc.

if datepicker control is that important, we can think about make a dll for it.
Admin
 
Posts: 86
Joined: Fri Oct 06, 2000 6:00 am
Location: USA

Postby guy on Fri Mar 30, 2001 6:39 am

But rather than writing a DLL with special stuff for each control and building it for each platform, would it not be simpler to update the sendmsg() function so that you can pass a struct in lparam?

No extra DLLs, for every possible platform
Simple interface
Same as real Windows interface
Code in just one place for all controls and messages.



Guy
Guy
[url]mailto:pcform@pcform.net[/url]
http://www.pcform.net
PocketC CE API interface: http://www.networkdynamics.net/PCForm.html#library
PCForm and CE API forum: http://www.networkdynamics.net/forum
guy
 
Posts: 879
Joined: Thu Dec 07, 2000 8:58 am
Location: United Kingdom

Postby ryo-h on Wed Jun 20, 2001 1:02 pm

There is a dirty walkaround.

Set the focus on to the datepicker.
Then use keyevent() function to simulate key inputs to set the appropriate date.

You can write your own function to set a date to a datepicker.

Something like:

d_set(int iCtl, int iYear, int iMonth, int iDay)

Use left-key and right-key to move around in the datepiker.

I tested this technique, and it works.


ryo@CE Factory
ryo@CE Factory
ryo-h
 
Posts: 5
Joined: Sun Jun 03, 2001 5:36 am
Location: Japan

Postby ryo-h on Sun Jun 24, 2001 8:54 am

Hi, everyone.
Here's what I've come up with.

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

send(int iKey) {
keyevent(iKey,0,0,0);
}

senddigit(int iN) {
// simulate key press for 2nd digit
send(floor(iN/10)+48);
// simulate key press for 1st digit
send(iN-floor(iN/10)*10+48);
}

setdate(int iCtl, int iY, int iM, int iD) {
int left, right;

left = 37; // left key value
right = 39; // right key value

guisetfocus(iCtl);

// set year
send(right);
senddigit(iY);

// set month
send(right);
senddigit(iM);

// set date
send(right);
senddigit(iD);
}

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

This code assumes that the datetimepicker is in the format of "yy/MM/dd" style.
You must start setting data from year, because an illegal date entry will be blocked by the OS.
You cannot type in "31" for the day, if the month is set to "06", and so on.


ryo@CE Factory
ryo@CE Factory
ryo-h
 
Posts: 5
Joined: Sun Jun 03, 2001 5:36 am
Location: Japan


Return to PocketC for CE

Who is online

Users browsing this forum: No registered users and 4 guests

cron