Topic: Script help please

Hi All...


Trying to prevent adding new record without selecting a treeview node. Could somebody correct the following script please?


procedure Form1_btnMainTaskADD_OnClick (Sender: string; var Cancel: boolean);
begin
If (Form1.TreeView4.RowCount > - 1) and (Form1.TreeView4.SelectedRow = False) then
   Begin
   MessageBox('Please select a Tree Node first.','Error',MB_OK+MB_ICONERROR);
   Cancel := True;
   Exit;
   End;
end;
Adam
God... please help me become the person my dog thinks I am.

Re: Script help please

Adam,
I don't work with treeviews, but I'm assuming it's the same as tablegrids. Try doing the following:

If (Form1.TreeView4.RowCount > 0) and (Form1.TreeView4.SelectedRow = -1) then

Re: Script help please

Hi EHW,


It worked fine.
Thank you very much...............

Adam
God... please help me become the person my dog thinks I am.