PDA

View Full Version : Toolbutton linkage


DJK
02-15-2004, 02:29 AM
Hey, I want to do something when I click in a button in the toolbar it opens a url according to what record you selected in the grid below, currently I have this which doesn't work like it should :


procedure TForm1.ToolButton4Click(Sender: TObject);
var
s: string;
begin
if (Column.FieldName = 'Info') then
begin
s := Column.Field.AsString;
if (s <> '') then
ShellExecute(Handle, 'open', PChar(s), nil, nil, SW_SHOW);
end;
end;


This works if you do it directly on "cell click" of the dbgrid, but it should only do it when you click a button 4 on the toolbar ..

Any help appreciated :)

Norrit
02-15-2004, 09:57 PM
Hi ...

This could mean 2 things:

#1: You haven't assigned Toolbutton4 to Toolbutton4Click - Check the events of Toolbutton4 ...

#2: "Column.FieldName" isn't assigned to "Info" - Go with the debugger through this code and see what it is instead ... Take your conclusions and adjust the code ...

MvG
Peter

<tt>Objective reality is a delirium caused by lack of alcohol in blood</tt>