Re: Strange behaviour on DBGrid lost focus (exit) on insert

[email protected]
Newsgroups gmane.comp.lang.delphi.programming
Message-ID <[email protected]>
Yes of course.

object Form1: TForm1
...
	object DBNavigator: TDBNavigator
	...
	end
	...
	object DBGrid1: TDBGrid
        	DataSource = DataSource1
	end
 	object EditID: TDBEdit
        	DataField = 'ID'
        	DataSource = DataSource1
	end
	...
	object DataSource1: TDataSource
    		DataSet = Table1
    		OnStateChange = DataSource1StateChange

  	end
end


procedure TForm1.DataSource1StateChange(Sender: TObject);
begin
  if (DataSource1.State in [dsEdit,dsInsert]) then
    editID.SetFocus;
end;

That's all
(Lately I am changing my idea by leaving the behaviour only for Insert).

The idea is that, if I ams with the focus on grid and I execute an Insert
action, the focus moves to combobox, but with the DataSet.State returns
into dsBrowse.

If you need more details, just tell me.

Regards,
Deck

>
> Hi,
>
> At July 28, 2003, 08:41, Marius wrote:
> &gt; I have a database application with both DBGrid (as read-only) and
> &gt; individual DB Aware controls. On insert, I want to move focus on
> the &gt; first DB control (a DBEdit, for ex.), but immediately after the
> new  &gt; control has received the focus, my DataSource.State moves from
>  &gt; dsInsert to dsBrowse. Can anyone geve me a hint on this?
>
> Can you give an example of your code and which event(s) your are
> using?
>
> --
> Best regards,
>  Daniel Rail
>  Senior System Engineer
>  ACCRA Group Inc. (www.accra.ca)
>  ACCRA Med Software Inc. (www.filopto.com)
>
>
>
>
>
>
>
>
>
> Yahoo! Groups Sponsor
>
>
>
>
>
>
>
>
>
>
>
>
> CodeCoffer - new Delphi code protection Tool!
> http://www.delphicollection.com/public/CodeCoffer.htm
> ---------------------------------------------------------------
> Unsubscribe:[email protected]
> List owner:[email protected]
> ---------------------------------------------------------------
>
>
>
> Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.





------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Toner for Your Printer or Fax at LaserTonerSuperstore.com-Save 55%!
We have your brand: HP, IBM, Canon, Xerox, Apple and many more for less!
http://www.LaserTonerSuperstore.com
http://us.click.yahoo.com/YmQqWC/qicGAA/ySSFAA/i7folB/TM
---------------------------------------------------------------------~->

CodeCoffer - new Delphi code protection Tool!
http://www.delphicollection.com/public/CodeCoffer.htm
---------------------------------------------------------------
Unsubscribe:[email protected]
List owner:[email protected]
--------------------------------------------------------------- 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.