Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » DBISAM Technical Support » Support Forums » DBISAM General » View Thread |
Messages 1 to 9 of 9 total |
value before post |
Thu, Nov 8 2007 3:27 PM | Permanent Link |
"Andrej Bivic" | I enter a string into a DBGrid. While typing, query is in edit mode. Ok. How
can I read the typed string befor post? I tried field.value and field.newvalue, but in both cases, I get NULL. Please, advise. Andrej |
Thu, Nov 8 2007 4:10 PM | Permanent Link |
Eryk Bottomley | Andrej,
> I enter a string into a DBGrid. While typing, query is in edit mode. Ok. How > can I read the typed string befor post? I tried field.value and > field.newvalue, but in both cases, I get NULL. You read Field.Value in the Query.OnBeforePost event handler (which you call by calling Query.Post). What you are probably trying to do is to read the value in the cell of the DBGrid before it has been written to the associated TField component. In this case you need to access the TInplaceEdit component that represents the cell. Eryk |
Thu, Nov 8 2007 5:12 PM | Permanent Link |
"Andrej Bivic" | I do not use any such component. I write directly into a grid cell and then
press F3 button (trough popupmenu connected to dbgrid) and there I need that value. Andrej "Eryk Bottomley" <no@way.com> wrote in message news:498E6EE7-64C3-4281-B772-81F45CC18519@news.elevatesoft.com... > Andrej, > >> I enter a string into a DBGrid. While typing, query is in edit mode. Ok. >> How can I read the typed string befor post? I tried field.value and >> field.newvalue, but in both cases, I get NULL. > > You read Field.Value in the Query.OnBeforePost event handler (which you > call by calling Query.Post). > > What you are probably trying to do is to read the value in the cell of the > DBGrid before it has been written to the associated TField component. In > this case you need to access the TInplaceEdit component that represents > the cell. > > Eryk |
Thu, Nov 8 2007 6:45 PM | Permanent Link |
Eryk Bottomley | Andrej,
> I do not use any such component. I write directly into a grid cell and then > press F3 button (trough popupmenu connected to dbgrid) and there I need that > value. When you "write directly into a grid cell" what actually happens is that a TInplaceEdit component (see Delphi on line help) is constructed and drawn in the place of the cell to accept keyboard and mouse input. The other issue you are encountering is that a visual control like a TInplaceEdit or a TDBEdit does not write its contents to the associated TField until it loses input focus (which means tabbing to the next cell in the case of a grid). You can access the text value entered in to the TInplaceEdit with a bit of hackery: type TCrackDBGrid = class(TDBGrid) published property InplaceEditor; end; procedure TForm1.DBGrid1KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin if (Key = VK_F3) and (DBGrid1.DataSource.DataSet.State in dsEditModes) then Caption := TCrackDBGrid(DBGrid1).InplaceEditor.Text; end; ....but when one ends up doing things like the above to fight against the design of the visual controls it usually means that there is a better approach to the problem at hand. Eryk |
Fri, Nov 9 2007 2:55 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Andrej
If its the TMS grid access it using its .Cells property Roy Lambert |
Fri, Nov 9 2007 4:06 AM | Permanent Link |
"Andrej Bivic" | Yes, I use TMS grid. Which property returns value I need?
Andrej "Roy Lambert" <roy.lambert@skynet.co.uk> wrote in message news:F2173937-50AE-4260-AACE-BFBF2576F669@news.elevatesoft.com... > Andrej > > > If its the TMS grid access it using its .Cells property > > Roy Lambert > |
Fri, Nov 9 2007 5:28 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Andrej
grid.Cells[grid.Col,grid.Row] will return the current cell as a string Roy Lambert |
Fri, Nov 9 2007 5:38 PM | Permanent Link |
"Andrej Bivic" | Are you sure? Couse I am getting a blank string instead of entered
characters. Andrej "Roy Lambert" <roy.lambert@skynet.co.uk> wrote in message news:02632984-2386-4559-BD27-40D5D1900E0E@news.elevatesoft.com... > Andrej > > > grid.Cells[grid.Col,grid.Row] will return the current cell as a string > > Roy Lambert > |
Sat, Nov 10 2007 3:37 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Andrej
I'm positive EMail me some code, or post into the binaries here, so I can see what you're doing Roy Lambert |
This web page was last updated on Tuesday, September 17, 2024 at 04:19 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |