RE: [DUG]: TwwdbGrid
Title: Message IP3000 (which is worth the upgrade BTW) has it too. The new Delphi procedure is OnDrawColumnCell which IP doesn't appear to implement. -Original Message-From: John Christenhusz [mailto:[EMAIL PROTECTED]] Sent: Wednesday, 15 August 2001 11:20To: Multiple recipients of list delphiSubject: RE: [DUG]: TwwdbGrid Thanks James for the code, this works great! As you wrote, using the OnDrawDataCell Event is apparently obsolete! What's the alternative? TIA John -Original Message- I think the problem is (I could be wrong here) that by changing then Field.Text you are actually attempting to change the underlying datasets field data, which is, by the looks of it, a float or currency field. From what I can tell you want to put a '+' sign in the Price Column if it matches the criteria. Try this work around, using the OnDrawDataCell Event (which is apparently obsolete but my version of IP doesn't have the OnDrawColumnCell) Procedure TformREDB.dbGridSearchDrawDataCell(Sender : Tobject; const Rect : Trect; Field : Tfield; State : TGridDrawState); Const PlusSign = '+'; Begin if (field.name = 'tblClientPrice') and (tblClientType.asInteger = 2) then wwwdbGridSearch.Canvas.TextOut(Rect.Left + 5, Rect.Top + 1, PlusSign); End;
RE: [DUG]: TwwdbGrid
Title: RE: [DUG]: TwwdbGrid Thanks James for the code, this works great! As you wrote, using the OnDrawDataCell Event is apparently obsolete! What's the alternative? TIA John -Original Message- I think the problem is (I could be wrong here) that by changing then Field.Text you are actually attempting to change the underlying datasets field data, which is, by the looks of it, a float or currency field. From what I can tell you want to put a '+' sign in the Price Column if it matches the criteria. Try this work around, using the OnDrawDataCell Event (which is apparently obsolete but my version of IP doesn't have the OnDrawColumnCell) Procedure TformREDB.dbGridSearchDrawDataCell(Sender : Tobject; const Rect : Trect; Field : Tfield; State : TGridDrawState); Const PlusSign = '+'; Begin if (field.name = 'tblClientPrice') and (tblClientType.asInteger = 2) then wwwdbGridSearch.Canvas.TextOut(Rect.Left + 5, Rect.Top + 1, PlusSign); End;
Re: [DUG]: TwwdbGrid
What is the datatype of the underlying database field for the field named tblClientPrice? My guess is that it's some kind of "number" and probably this means the component will call the StrToFloat function to covert the new "text" to the internal float value >From the help StrToFloat (about coverting a string S): " S must consist of an optional sign (+ or -), a string of digits with an optional decimal point, and an optional mantissa. The mantissa consists of 'E' or 'e' followed by an optional sign (+ or -) and a whole number. Leading and trailing blanks are ignored." I see 3 possible problems with what you have here. 1. If the field is null, text will be '' and you will try to assign the new value '+ ' to it - which doesn't fit the rule above. 2. If the field has a negative value (say -123.45) - text will already have a preceding minus sign. You will attempt to assign the new value '+ -123.45' - also violating the format rule above. 3. Even if the field has non-negative value (say 123.45) your new text value will be '+ 123.45' - also violating the rule because of the blank. You can fix up #3 here by tacking on '+' instead of '+ ' (remove the trailing blank) but you still have 1 & 2 to worry about. But finally - I am missing the whole point of the '+' here. When you assign to text properties of fields with floating point values, the component will immediately convert your text to the underlying value. If you then turn around and look at the text property, it will be the result of converting the value back into a string.So your sign won't be there. So I don't understand the purpose of the trick with the plus sign. -ns - Original Message - From: "John Christenhusz" <[EMAIL PROTECTED]> To: "Multiple recipients of list delphi" <[EMAIL PROTECTED]> Sent: Wednesday, August 15, 2001 5:09 AM Subject: [DUG]: TwwdbGrid > Hi folks, > > I want to change the text in a TwwdbGrid for a particular item. The > following code doesn't work: > > procedure TformREDB.dbgridSearchCalcCellColors(Sender: TObject; Field: > TField; > State: TGridDrawState; Highlight: Boolean; AFont: TFont; ABrush: > TBrush); > begin > if (field.name = 'tblClientPrice') and (tblClientType.asInteger = 2) > then > field.text := '+ ' + field.text; > end; > > It generates the following error:'+ ' is not a valid floating point > value for field 'Price' > > Any ideas how to solve this problem? > > TIA > > John. > --- New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED] Website: http://www.delphi.org.nz To UnSub, send email to: [EMAIL PROTECTED] with body of "unsubscribe delphi" Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/
RE: [DUG]: TwwdbGrid
Title: RE: [DUG]: TwwdbGrid I think the problem is (I could be wrong here) that by changing then Field.Text you are actually attempting to change the underlying datasets field data, which is, by the looks of it, a float or currency field. From what I can tell you want to put a '+' sign in the Price Column if it matches the criteria. Try this work around, using the OnDrawDataCell Event (which is apparently obsolete but my version of IP doesn't have the OnDrawColumnCell) Procedure TformREDB.dbGridSearchDrawDataCell(Sender : Tobject; const Rect : Trect; Field : Tfield; State : TGridDrawState); Const PlusSign = '+'; Begin if (field.name = 'tblClientPrice') and (tblClientType.asInteger = 2) then wwwdbGridSearch.Canvas.TextOut(Rect.Left + 5, Rect.Top + 1, PlusSign); // you might want to play with the rect.left to //get a value that looks good. End; -Original Message- From: John Christenhusz [mailto:[EMAIL PROTECTED]] Sent: Wednesday, 15 August 2001 10:09 To: Multiple recipients of list delphi Subject: [DUG]: TwwdbGrid Hi folks, I want to change the text in a TwwdbGrid for a particular item. The following code doesn't work: procedure TformREDB.dbgridSearchCalcCellColors(Sender: TObject; Field: TField; State: TGridDrawState; Highlight: Boolean; AFont: TFont; ABrush: TBrush); begin if (field.name = 'tblClientPrice') and (tblClientType.asInteger = 2) then field.text := '+ ' + field.text; end; It generates the following error: '+ ' is not a valid floating point value for field 'Price' Any ideas how to solve this problem? TIA John.
[DUG]: TwwdbGrid
Hi folks, I want to change the text in a TwwdbGrid for a particular item. The following code doesn't work: procedure TformREDB.dbgridSearchCalcCellColors(Sender: TObject; Field: TField; State: TGridDrawState; Highlight: Boolean; AFont: TFont; ABrush: TBrush); begin if (field.name = 'tblClientPrice') and (tblClientType.asInteger = 2) then field.text := '+ ' + field.text; end; It generates the following error:'+ ' is not a valid floating point value for field 'Price' Any ideas how to solve this problem? TIA John. winmail.dat
Re: [DUG]: TwwDBGrid
John, the only other thing I can thnk of is that you are using Tfields for storage of info except that you havent made them persistent. SO, when the table is closed, they disappear. To: Multiple recipients of list delphi <[EMAIL PROTECTED]> Send reply to: [EMAIL PROTECTED] From: "John Christenhusz" <[EMAIL PROTECTED]> Subject: [DUG]: TwwDBGrid Date sent: Thu, 18 May 2000 21:41:19 +1200 > Hi all, > > Is there any way of enlarging the size of a grid in a TwwDBGrid. This to > allow multiple lines for a 100 character field cell. > I can do this at design-time or at run time, but when the associated table > is closed and opened again, the cell size is back to a single line and 100 > characters long. > > > Thanks for any help. > > John Christenhusz > C/- Post Office > PUHOI - 1240 > Phone:09-422.0601 > Mobile: 021-johnch (021-564624) > E-mail: [EMAIL PROTECTED] > > > Rohit == CFL - Computer Fanatics Ltd. 21 Barry's Point Road, AKL, New Zealand PH(649) 489-2280 FX(649) 489-2290 email [EMAIL PROTECTED] or [EMAIL PROTECTED] == --- New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED] Website: http://www.delphi.org.nz
Re: [DUG]: TwwDBGrid
Try unticking the "use Tfields for storage". -Original Message- From: John Christenhusz <[EMAIL PROTECTED]> To: Multiple recipients of list delphi <[EMAIL PROTECTED]> Date: Friday, 19 May 2000 06:02 Subject: [DUG]: TwwDBGrid >Hi all, > >Is there any way of enlarging the size of a grid in a TwwDBGrid. This to >allow multiple lines for a 100 character field cell. >I can do this at design-time or at run time, but when the associated table >is closed and opened again, the cell size is back to a single line and 100 >characters long. > > >Thanks for any help. > >John Christenhusz >C/- Post Office >PUHOI - 1240 >Phone: 09-422.0601 >Mobile: 021-johnch (021-564624) >E-mail: [EMAIL PROTECTED] > > > --- New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED] Website: http://www.delphi.org.nz
[DUG]: TwwDBGrid
Hi all, Is there any way of enlarging the size of a grid in a TwwDBGrid. This to allow multiple lines for a 100 character field cell. I can do this at design-time or at run time, but when the associated table is closed and opened again, the cell size is back to a single line and 100 characters long. Thanks for any help. John Christenhusz C/- Post Office PUHOI - 1240 Phone: 09-422.0601 Mobile: 021-johnch (021-564624) E-mail: [EMAIL PROTECTED] winmail.dat