hello, I would like to ask you to look at the following question.
I have created a window including a listbox and a Inputline, which contains the
selected name and two button to cancel the operation and make your final
choise. When I double click on a name listed in the listbox it is displayed in
de inputline. Only when i have selected a name and press the button to cancel
the operation it doesn't react the same for final selction. I will include a
part of the source.
I hope anybody is able to help me out.
TYPE
PVerzameling = ^TVerzameling;
TVerzameling = Object(TStringCollection)
constructor init;
END;
PPickLine = ^TPickLine;
TPickLine = Object(TInputLine)
procedure HandleEvent(var event:tevent);virtual;
end;
PScherm = ^Tscherm;
TScherm = Object(TDialog)
Verzameling :PVerzameling;
CONSTRUCTOR Init;
DESTRUCTOR Done;VIRTUAL;
END;
VAR NAAM:String;
{ --------------------------------------------------------------------------}
CONSTRUCTOR TVerzameling.Init;
Begin
inherited Init(2, 25);
gotop;
While not deof do
begin
INSERT(newstr(StringGet('naam')));
Skip(1);
end;
end;
PROCEDURE Tpickline.HandleEvent(var Event:tEvent);
BEGIN
inherited handleEvent(event);
IF Event.What=evBroadCast THEN
BEGIN
IF Event.Command=CmListItemSelected THEN
begin
with PlistBox(event.InfoPtr)^ do
begin
Data^:=gettext(focused,25);
naam:=data^;
end;
ClearEvent(Event);
DrawView;
end;
END;
IF Event.What =evCommand THEN
CASE Event.Command OF
CmHefOp:
begin
naam:='';
Free;
end;
CmOke:
begin
with PlistBox(event.InfoPtr)^ do
begin
Data^:=gettext(focused,25);
naam:=data^;
end;
Free;
end
END;
ClearEvent(event);
END; {HandleEvent}
CONSTRUCTOR TScherm.Init;
VAR
R : Trect;
Sb : PScrollbar;
control : pview;
BEGIN
R.Assign(0,0,60,15);
TDialog.Init(R,'Keuzelijst');
options:= options or ofcentered;
R.Assign(53,2,54,12);
New(SB,Init(R));
Insert(SB);
R.Assign(26,2,53,12);
Control:=New(PlistBox,Init(R,1,SB));
Insert(Control);
PListBox(Control)^.NewList(New(PVerzameling,Init));
R.Assign(15,2,21,3);
Insert(New(Plabel, Init(R, 'Stal :',Control)));
R.Assign(2,4,21,5);
Control := New(PPickLine, Init(R,25));
Control^.Eventmask := Control^.eventMask or evBroadcast;
insert(Control);
R.Assign(10,13,22,15);
Insert(New(PButton,Init
(R,'~K~ies',CmHefOp,BfNormal)));
R.Assign(38,13,50,15);
Insert(New(PButton,Init
(R,'~H~ef op',CmHefOp,BfNormal)));
HelpCtx := HcLijst;
END;
DESTRUCTOR TScherm.Done;
BEGIN
TDialog.Done;
IF Verzameling <> Nil THEN Dispose(Verzameling,Done)
END;
PROCEDURE ToonLijst;
VAR
Scherm:PScherm;
BEGIN
Scherm := NEW(PScherm,Init);
IF Application^.ValidView(Scherm) <> Nil THEN
Desktop^.Insert(Scherm);
END;