Discussions related to Visual Prolog
User avatar
Ferenc Nagy
VIP Member
Posts: 215
Joined: 24 Apr 2007 12:26

Problems withs automatically generated code belonging to Scilex controls

Unread post by Ferenc Nagy »

I have got "single fact has no value" runtime error message when I set EdgeMode property to 1.
Single fact has no value

error code = 329
ExtraInfo = Single fact 'native' from internal database 'sciLexer::sciLexer@objectDB' has no value
The error arose here.

Code: Select all

edgeMode(EdgeMode) :-         sciLexer_api::setEdgeMode(native, EdgeMode).
Cause: when generatedInitialize was executed the statement

Code: Select all

sciLexer_ctl:edgeMode := 1
then the native single fact was not initialized.

Workaround:
Throw out the setting of the edge mode from the property sheet and move the above code line to the onShow listener.

Code: Select all

predicates     onShow : window::showListener. clauses     onShow(_Source, _Data) :-         % The lines moved from the automatically generated code here.         sciLexer_ctl:edgeMode := 1,
Important: This kind of error repeats for all properties of the Scilex control which are set using the native fact variable. See the source file c:\program files (x86)\visual prolog 7.5 pe\pfc\gui\controls\scilexer\scilexer.pro in the line range 4480+-100. The setting of many properties should be moved to a generatedOnShow predicate.
TIA, Regards,
Frank Nagy
User avatar
Thomas Linder Puls
VIP Member
Posts: 1398
Joined: 28 Feb 2000 0:01

Unread post by Thomas Linder Puls »

Yes, it is correct that many control properties (especially on a rich external control like the sciLexer) cannot be used before the actual control is created; which take place in the "show" process.

Code: Select all

clauses     new(Parent, EdgeMode) :-         formWindow::new(Parent),         generatedInitialize(),         addShowListener({ :-             sciLexer_ctl1:edgeMode := EdgeMode,             sciLexer_ctl2:edgeMode := EdgeMode,             sciLexer_ctl3:edgeMode := EdgeMode             % Other "late" initialization         }).
Regards Thomas Linder Puls
PDC
Post Reply