The following program adds in a window a listEdit object with a selectionChangedListener. If we add something into the list of the listEdit object, and select the Index item in the list control, it triggers an event catched by the selectionChangedListener.
In VIP 7.4, the Source given by the listener identifies a list Control object corresponding to the listEdit box (same number) :
If we look at the "Variable of the current clause" window :
Source : listControl = <listEdit xxxxxxxxx>
> listEdit$objectDB
In VIP 7.5, the Source given by the listener is a listButton object with a different number by the two last digits.
If we look at the "Variable of the current clause" window :
Source : listControl = <listEdit xxxxxxxyy>
> listButton@objectDB
If we want to convert the Source in a listEdit domain, it triggers an exception.
What is the reason of the intervention, in VIP 7.5, of a listButton which was never created ? Is possible to get from this number the listEdit affected by the event in VIP 7.5 ?
Code: Select all
implement conteneur
inherits formWindow
open core, vpiDomains
clauses
display(Parent) = Form :-
Form = new(Parent),
Form:show().
clauses
new(Parent):-
formWindow::new(Parent),
generatedInitialize(),
stdIO::write(listEdit_ctl, "\n").
clauses
% launched in the taskwindow in the event "file new" after creating the conteneur object
% with 'listEdit_ctl' as CONTROL and "toto" as VALUE
setValueSelected(Control, Value):-
stdIO::write(Control, "\n"),
Control:addList(["lolo", "lulu", "toto"]),
Control:setText(Value),
Liste = Control:getAll(),
Index = list::tryGetIndex(Value, Liste), !,
Control:selectAt(Index, true()).
setValueSelected(_, _).
predicates
onListEditSelectionChanged : listControl::selectionChangedListener.
clauses
onListEditSelectionChanged(Source):-
stdIO::write(Source, "\n"),
_ = convert(listEdit, Source),
Source = listEdit_ctl,
!.
onListEditSelectionChanged(_Source).
predicates
onOkValidate : control::validateResponder.
clauses
onOkValidate(_Source) = control::contentsOk:-
close().
% This code is maintained automatically, do not update it manually. 16:30:04-3.8.2014
facts
ok_ctl : button.
listEdit_ctl : listEdit.
predicates
generatedInitialize : ().
clauses
generatedInitialize():-
setFont(vpi::fontCreateByName("Tahoma", 8)),
setText("Conteneur"),
setRect(rct(50,40,290,160)),
setDecoration(titlebar([closeButton,maximizeButton,minimizeButton])),
setBorder(sizeBorder()),
setState([wsf_ClipSiblings,wsf_ClipChildren]),
menuSet(noMenu),
ok_ctl := button::newOk(This),
ok_ctl:setText("&OK"),
ok_ctl:setPosition(180, 102),
ok_ctl:setSize(56, 16),
ok_ctl:defaultHeight := false,
ok_ctl:setAnchors([control::right,control::bottom]),
ok_ctl:addValidateResponder(onOkValidate),
listEdit_ctl := listEdit::new(This),
listEdit_ctl:setText("List Edit"),
listEdit_ctl:setPosition(136, 12),
listEdit_ctl:setWidth(84),
listEdit_ctl:setMaxDropDownRows(1),
listEdit_ctl:addSelectionChangedListener(onListEditSelectionChanged).
% end of automatic code
end implement conteneur

