From bugtracker@delphi-jedi.org Thu Nov 11 11:19:05 2010 Received: from [62.141.94.155] (HELO mx5.ks.pochta.ru) by node1-3.ks.pochta.ru with QIP.RU LMTP for the_arioch@newmail.ru; Thu, 11 Nov 2010 14:19:05 +0300 Received: from artemis.grizzlydev.com ([87.98.176.28]) by mx5.ks.pochta.ru with QIP.RU SMTP for the_arioch@newmail.ru; Thu, 11 Nov 2010 14:19:05 +0300 X-QIP-Sender: 87.98.176.28 Received: (qmail 5865 invoked by uid 553); 11 Nov 2010 11:19:05 -0000 To: the_Arioch@nm.ru Subject: [JEDI VCL 0004651]: TJvDBDatePicker Date: Thu, 11 Nov 2010 14:19:05 +0300 From: "Mantis Bug Tracker" Message-ID: <9570fd7b9e1b8f159eab92af7066aa44@issuetracker.delphi-jedi.org> X-Priority: 3 X-Mailer: PHPMailer (phpmailer.codeworxtech.com) [version 2.3] Keywords: [JEDI VCL] 00 JVCL Components In-Reply-To: <94cbf98288e7636950ac0da86e228f26> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="utf-8" X-AntiVirus: checked (incoming) by AntiVir MailGuard (Version: 10.0.1.38; AVE: 8.2.4.92; VDF: 7.10.13.208) ? ?????????? ??????? ???????? ???????????: ====================================================================== http://issuetracker.delphi-jedi.org/view.php?id=4651 ====================================================================== ?????????: ZENsan ??????????: obones ====================================================================== ??????: JEDI VCL ????? ???????: 4651 ?????????: 00 JVCL Components ?????????????????: ?????? ???????????: ?????????? ?????????: ??????? ?????????: ????? ?????? ====================================================================== ??????: 2009-01-08 05:27 CET ???????: 2010-11-11 12:19 CET ====================================================================== ????: TJvDBDatePicker ???????????: If NullText <> '' then for NULL field if we just press arrow button and then lose focus from combobox - TDateTimeEdit raises exception that we need to be in ShowCheckboxes mode. To fix this issue I can suggest this code. Do not know if it is 100% correct, but it works. ====================================================================== ????? ????????? ---------------------------------------------------------------------- ?????? ? 0005335 Call Inherited in CNNotify TJvDateTimeP... ====================================================================== ---------------------------------------------------------------------- (0015247) ZENsan (?????????) - 2009-01-15 08:10 http://issuetracker.delphi-jedi.org/view.php?id=4651#c15247 ---------------------------------------------------------------------- Some news, guys? ---------------------------------------------------------------------- (0015447) obones (?????????????) - 2009-04-29 11:43 http://issuetracker.delphi-jedi.org/view.php?id=4651#c15447 ---------------------------------------------------------------------- Please provide the zipped sources of a sample application showing this. ---------------------------------------------------------------------- (0015505) ZENsan (?????????) - 2009-04-30 15:23 http://issuetracker.delphi-jedi.org/view.php?id=4651#c15505 ---------------------------------------------------------------------- Just press arrow on DatePicker, and then click in any other place on the form (deactivate datepicker). I think it is not normal appereance. ---------------------------------------------------------------------- (0015526) ZENsan (?????????) - 2009-05-18 17:01 http://issuetracker.delphi-jedi.org/view.php?id=4651#c15526 ---------------------------------------------------------------------- Hello? ---------------------------------------------------------------------- (0015788) obones (?????????????) - 2009-07-08 15:47 http://issuetracker.delphi-jedi.org/view.php?id=4651#c15788 ---------------------------------------------------------------------- Thanks, this is now in SVN ---------------------------------------------------------------------- (0018083) Arioch (????????) - 2010-11-11 03:54 http://issuetracker.delphi-jedi.org/view.php?id=4651#c18083 ---------------------------------------------------------------------- requires reconsidering. Shoud be discussed either here or in NNTP or in wiki. NNTP is comfort to discuss, but then has no WWW links to re-read. at least this lead to http://issuetracker.delphi-jedi.org/view.php?id=5335, which is worse. I told in comments there. ---------------------------------------------------------------------- (0018085) Arioch (????????) - 2010-11-11 04:08 http://issuetracker.delphi-jedi.org/view.php?id=4651#c18085 ---------------------------------------------------------------------- I'd re-state. 1) if this quick and dirty patch is to be made - it should be made in procedure TJvDBDateTimePicker.CNNotify not touching procedure TJvDateTimePicker.CNNotify nor touching any other component. 2) TJvDBDateTimePicker tries to outsmart Windows itself and VCL, especially with MemoryDataset. 2.1) MemoryDataset originated in ancient times of 16-bit Delphi1/Windows3 and since RxLib strived to support all Delphi versions through (from 16-bit 1 to 32-bit D5 oficially and to D7 unofficially when merged with JVCL) and to my experience is itsef quick-and-dirty (or maybe obsolete-hence-dirty). I was never sure it would always act *exactly* like other datasets do. So - at least in this demo - the component just asks for trouble. And should deal with it self. ---------------------------------------------------------------------- (0018086) Arioch (????????) - 2010-11-11 04:13 http://issuetracker.delphi-jedi.org/view.php?id=4651#c18086 ---------------------------------------------------------------------- foreword - i modified example with ===== procedure TfrmMain.showRows; begin Caption := IntToStr(MData.RecordCount) +' rows'; end; procedure TfrmMain.MDataAfterClose(DataSet: TDataSet); begin showRows; end; procedure TfrmMain.MDataAfterDelete(DataSet: TDataSet); begin showRows; end; procedure TfrmMain.MDataAfterInsert(DataSet: TDataSet); begin showRows; end; procedure TfrmMain.MDataAfterOpen(DataSet: TDataSet); begin showRows; end; procedure TfrmMain.MDataAfterScroll(DataSet: TDataSet); begin showRows; end; procedure TfrmMain.MDataBeforeInsert(DataSet: TDataSet); begin showRows; end; procedure TfrmMain.MDataNewRecord(DataSet: TDataSet); begin showRows; end; ==== Thus i hope to always know how many rows in the table. Surprise - they always zero. Events do fire. When i open drop-down picker, i see events fired: BeforeInsert, OnNewRecord, AfterInsert, AfterScroll So seems the picker tries to silently insert new row into empty dataset. However MemoryDataSet.RecordsCount still remains zero - empty table. ---------------------------------------------------------------------- (0018087) Arioch (????????) - 2010-11-11 04:53 http://issuetracker.delphi-jedi.org/view.php?id=4651#c18087 ---------------------------------------------------------------------- Now, right in the IDE toggle MemoryDataset.Active - you would see that text in the Picker changes. If table is closed - it just shows Now; if table is opened - though Empty - it contains placeholder, that very NullText <> '' Is it correct to assume NULL value, when there is no single row in the dataset ??? Is it bug in the Picker, in the Dataset or in both ? ------------ Now, looking at TJvDateTimePicker.CheckNullValue 1) Is it okay, when TJvDateTimePicker.NullText is set and TJvDateTimePicker.CheckNullDate is not ? 2) Is TJvDateTimePicker.CheckNullValue supposed not only to override date format (via SendMessage) but also the time itself in windows control? 3) it is done in CNNotify only if ParseInput is set to True. Overall Peter's comments on that feature in file header are shocking a bit. The feature was added with arge restriction and for knowledgable person that would manually control all that. Peter probably was the person, yet TJvDBDatePicker is certainy not. ------ float value 0.0 corresponds to Delphi's TDateTime value of 31-dec-1899 Set NullDate to somethign different, and the demo behaviour radicaly changes. 1) it does no more through the exception on NullText value 2) it does through exception on 31-dec-1899 value 3) suddenly! you can change date via arrows - left/right select day/month/year and up/down adjust value. Select date like NullDate + 1 year, then using arrows try to decrement year. You'd expect to get Nulldate then, but you'll get 31-dec-1899 instead. So this issue is not NullText-related but is NullDate- and DataSet-related. NullText is having two functions: to contain the text and as flag enablling/disabling the functionality. That confused topic starter. ---------------------------------------------------------------------- (0018088) Arioch (????????) - 2010-11-11 05:03 http://issuetracker.delphi-jedi.org/view.php?id=4651#c18088 ---------------------------------------------------------------------- The DatePicker is not our toy, but is a wrapper arounf Microsoft's control. What are it's limitations ? 1) it provides for NULL value, but not in a way of custom text. MS uses checkbox for it. See VCL help for TDateTimePicker.ShowCheckbox and MSDN for DTS_SHOWNONE 2) it only provides for standard, Windows-generated text unless you allow free-form user typing in. See VCL help for TDateTimePicker.ParseInput and MSDN for DTS_APPCANPARSE Stepping aside those rules seems to make control into non-standard, unpredictable behaviour. Or related controls. ---------------------------------------------------------------------- (0018089) Arioch (????????) - 2010-11-11 05:16 http://issuetracker.delphi-jedi.org/view.php?id=4651#c18089 ---------------------------------------------------------------------- JvDBDateTimePicker is to acknowledge NULL value of datasets' fields. 1) it should check TField.Required and either set TDateTimePicker.ShowCheckbox := not TField.Required or refuse to operate to nullable fields. 2) it should tell empty field and field with date 0.0 (aka 31-dec-1899) 2.1) i don't know why TField.AsDateTime can be read on NULL field at all. To me it should just through exception, not making NULL == 0.0 Again, this seems to be a bug either in VCL TField class, or in JVCL TJvMemoryDataset. Or maybe that is standard Borland's design of VCL ? i don't remember it today. Few years ago when i messed with TDbf.sf.net project, i'd answer :-) Probably MemoryDataset just can't make difference between NULL and 0 at all. 3) probably JvDBDateTimePicker should avoid reading from empty datasets and plus to it, probably JvMemoryDataset should also prohibit it. I can see some reasoning behind automagical insertion of new row into table, when i edit date and write some value into nowhere. But inserting row when i am just reading? nonsense, isn't it ? Maybe NullText is to be never allowed on DBDatePicker in 1st place. Maybe even if someone clarified a the questions above and fixed all those troubles, it would still be fragie and lead to unexpected behaviour between Microsoft CommCtrl and BorlandVCL and JVCL and all their sudden interactions. At least i was tracing them for hour and half and then thought about them and made more tests and... and still aint sure. OKay i'm falling asleep now. ---------------------------------------------------------------------- (0018090) Arioch (????????) - 2010-11-11 05:25 http://issuetracker.delphi-jedi.org/view.php?id=4651#c18090 ---------------------------------------------------------------------- If any, i think NullText is to be kept, then it should just be wired to TField.DisplayText DB-aware controls should not decide such things on themselves, but rather should obey to TDataSet and such. Same way, DTP's OnUserInput should be routed to TField.OnSetText. all-in-all that for me asks for decoupling, so NullText and OnUserInput be not public in JvDBDateTimePicker. Thus, it should not be derived directly from JV-DTP, but they rather hard common 3rd ancestor, like JvCustomDTP, with the prperties kept protected and not reachable for application developer. ---------------------------------------------------------------------- (0018091) Arioch (????????) - 2010-11-11 05:26 http://issuetracker.delphi-jedi.org/view.php?id=4651#c18091 ---------------------------------------------------------------------- > If any, i think NullText is to be kept, read: if in-spite all this NullText still be kept, then i think.... ---------------------------------------------------------------------- (0018093) Arioch (????????) - 2010-11-11 12:19 http://issuetracker.delphi-jedi.org/view.php?id=4651#c18093 ---------------------------------------------------------------------- one more snarling... bug was reported for certain situation "If NullText <> '' then" so this destructive so-called fix also should at very least be deployed into that situations and not be always active. PS: that's when imperative languages lack Guards and tail recursion and only have goto for optimization :-) ??????? ???? ????????????????????????? ????????? ====================================================================== 2009-01-08 05:27 ZENsan ????? ?????? 2009-01-15 08:10 ZENsan ??????????? ????????: 0015247 2009-02-02 01:22 obones ????????? ????? => ?????????? 2009-04-29 11:43 obones ??????????? ????????: 0015447 2009-04-29 11:43 obones ????????? ?????????? => ????? ?????? 2009-04-30 15:22 ZENsan ???? ????????: DatePicker.zip 2009-04-30 15:23 ZENsan ??????????? ????????: 0015505 2009-05-18 17:01 ZENsan ??????????? ????????: 0015526 2009-07-06 14:11 obones ????????? ????? ?????? => ?????????? 2009-07-08 15:47 obones ??????????? ????????: 0015788 2009-07-08 15:47 obones ????????? ?????????? => ????????? 2009-07-08 15:47 obones ????? ? ?????? => Daily / SVN 2009-07-08 15:47 obones ??????? ?????? => ????? 2009-07-08 15:47 obones ????????????? => obones 2010-10-08 16:38 obones ????? ??????????????? ? 0005335 2010-11-11 03:54 Arioch ??????????? ????????: 0018083 2010-11-11 03:54 Arioch ????????? ????????? => ????? ?????? 2010-11-11 03:54 Arioch ??????? ????? => ???????? ?????? 2010-11-11 04:08 Arioch ??????????? ????????: 0018085 2010-11-11 04:13 Arioch ??????????? ????????: 0018086 2010-11-11 04:53 Arioch ??????????? ????????: 0018087 2010-11-11 05:03 Arioch ??????????? ????????: 0018088 2010-11-11 05:16 Arioch ??????????? ????????: 0018089 2010-11-11 05:25 Arioch ??????????? ????????: 0018090 2010-11-11 05:26 Arioch ??????????? ????????: 0018091 2010-11-11 12:19 Arioch ??????????? ????????: 0018093 ======================================================================