Hi there,
(by the way anyone knows where to download latest d7 service pack?: need to kill delphi32 about 3 times per day when closing IDE...)
Using Delphi 7... Here's my problem:
I have one main Unit (Grid) which uses a SubUnit (Combo).
After a combo selection is done in the SubUnit, I need to send back the selected value to the main Unit.
Thats is, I think the best way to achieve this is to use a function pointer (or in this case a procedure pointer). Something like:
/////////////////////////////////////////////////////////
procedure MainUnit.OnComboOpen(Sender: TObject);
begin
SubUnit.AfterComboSelect := Addr(OnComboSelect);
end;
procedure MainUnit.OnComboSelect(Sender: TObject);
begin
Cells[Col, Row] := (Sender as TComboBox).Text
end;
//////////////////////////////////////////////////////////
procedure SubUnit.OnClick(Sender: TObject);
begin
AfterComboSelect(Self);
end;
procedure SubUnit.OnKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
begin
if Key = VK_RETURN then AfterComboSelect(Self);
end;
procedure SubUnit.AfterComboSelect(Sender: TObject);
begin
Hide;
// HOW TO SEND BACK RESULT TO MAIN UNIT ???
// (call to MainUnit.OnComboSelect(Self)
end;
//////////////////////////////////////////////////////////
Anyone can help?
Thanks in advance,
Rej Cloutier
(by the way anyone knows where to download latest d7 service pack?: need to kill delphi32 about 3 times per day when closing IDE...)
Using Delphi 7... Here's my problem:
I have one main Unit (Grid) which uses a SubUnit (Combo).
After a combo selection is done in the SubUnit, I need to send back the selected value to the main Unit.
Thats is, I think the best way to achieve this is to use a function pointer (or in this case a procedure pointer). Something like:
/////////////////////////////////////////////////////////
procedure MainUnit.OnComboOpen(Sender: TObject);
begin
SubUnit.AfterComboSelect := Addr(OnComboSelect);
end;
procedure MainUnit.OnComboSelect(Sender: TObject);
begin
Cells[Col, Row] := (Sender as TComboBox).Text
end;
//////////////////////////////////////////////////////////
procedure SubUnit.OnClick(Sender: TObject);
begin
AfterComboSelect(Self);
end;
procedure SubUnit.OnKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
begin
if Key = VK_RETURN then AfterComboSelect(Self);
end;
procedure SubUnit.AfterComboSelect(Sender: TObject);
begin
Hide;
// HOW TO SEND BACK RESULT TO MAIN UNIT ???
// (call to MainUnit.OnComboSelect(Self)
end;
//////////////////////////////////////////////////////////
Anyone can help?
Thanks in advance,
Rej Cloutier