--- In [EMAIL PROTECTED], Ali Gunawan <[EMAIL PROTECTED]> wrote:
> jadi SelectedIndex[0].SetFocus , gitu ?

Setau saya SelectedIndex itu propertynya integer deh. Mana bisa di 
setfocus ?
Tapi selectedField atau Selectedindex itu baru bisa berfungsi kalo 
focuscontrolnya ada di dbgrid , kalo ngak terpaksa dbgridnya di 
tambahin setfocus.
Jadi codingnya selectedfield atau index = 0 pada event onclick pada 
panah bawah atau atas.
Atau pake Focuscontrol utk di field tablenya yg di asosiasikan dgn 
dataaware. Kelebihannya ngak perduli focusnya ada dikomponen apa 
pokoknya dia akan maksa aplikasi utk focus ke field itu. 
Lagian ngapain sih susah susah. Tambahin aja di event keypressnya
if (Key = #13) and not (ActiveControl is TDBRichEdit) and
  not (ActiveControl is TMaskEdit) and not (ActiveControl is 
TxpButton) and
  not (ActiveControl is TLookupDbEdit) and not (ActiveControl is 
TLookupEdit)
  then begin
    Key := #0;

    if not (ActiveControl is TDBGrid) then
      Perform(WM_NEXTDLGCTL, 0, 0)
    else
      with TDBGrid(ActiveControl) do
        if selectedindex < (fieldcount -1) then
          selectedindex := selectedindex +1
        else begin
          selectedindex := 0;

          if DataSource.DataSet.State <> dsInsert then begin
            DataSource.DataSet.Next;

            if (DataSource.DataSet.Eof) and (DataSource.DataSet.State 
<> dsInsert) then
              DataSource.DataSet.Append;
          end
          else begin
            DataSource.DataSet.Append;
          end;
        end;
  end;
dan di event keydownnya
if (Shift = []) and (ActiveControl is TDBGrid) then begin
    if Key = VK_UP then begin
      Key := 0;
      Perform(WM_NEXTDLGCTL, 1, 0);
    end
    else if Key = VK_DOWN then begin
with TDBGrid(ActiveControl) do
        if selectedindex < (fieldcount -1) then
          selectedindex := selectedindex +1
        else begin
          selectedindex := 0;
      Key := 0;
if DataSource.DataSet.State <> dsInsert then begin
            DataSource.DataSet.Next;

            if (DataSource.DataSet.Eof) and (DataSource.DataSet.State 
<> dsInsert) then
              DataSource.DataSet.Append;
          end
          else begin
            DataSource.DataSet.Append;
          end;
    end
  end;
end;
Terus tinggal di inherit ke setiap dbgrid yg ada di aplikasi anda.

BTW, mungkin begin..endnya ngak pas harus dicek lagi.

Salam,
Aris


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark
Printer at MyInks.com. Free s/h on orders $50 or more to the US & Canada.
http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/i7folB/TM
---------------------------------------------------------------------~->

Berlangganan: [EMAIL PROTECTED]
Stop Berlangganan: [EMAIL PROTECTED]
Keluhan Milis(Unbouncing,spam,dll): [EMAIL PROTECTED] 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 


Kirim email ke