Undeclared Identifier

Discussions related to Visual Prolog
Loffy
Active Member
Posts: 47
Joined: 15 Aug 2019 11:32

Undeclared Identifier

Unread post by Loffy » 16 Aug 2019 9:37

Thomas,

Re the error, it was in the automatic code for a dialog box. (The box was quite small with four controls: text; edit; OK; Cancel).

Last night I recalled that I had reduced the size of the dialog window to more closely relate to the size of the dialogs. So I went back and enlarged the dialog window.

The problem went away. (And I do not have a screenshot of the error and code). Sorry.

However, today I tried to repeat the error and I can't. Even after making the dialog box quite small the problem does not happen.

Attached you will find a text copy of the relevant code as it exists today.

My question is why did the error yesterday refer to the setRect line as setRect/5 when the code today only has 4 arguments?.

I will do better next time if I have an automatic code error.

Regards,

Loffy
Attachments
Error.txt
(1.41 KiB) Downloaded 17 times

User avatar
Thomas Linder Puls
VIP Member
Posts: 1625
Joined: 28 Feb 2000 0:01

Re: Undeclared Identifier

Unread post by Thomas Linder Puls » 16 Aug 2019 11:28

Just include code directly in the text (enclosing it by [code]..[/code]) tags, then it will look like this:

Code: Select all

% This code is maintained automatically, do not update it manually. %  17:51:34-16.8.2019   facts     ok_ctl : button.     cancel_ctl : button.     id_ctl : editControl.   predicates     generatedInitialize : (). clauses     generatedInitialize() :-         setText("prime"),         setRect(rct(50, 40, 172, 114)),         setModal(true),         setDecoration(titlebar([closeButton])),         setState([wsf_NoClipSiblings]),         id_ctl := editControl::new(This),         id_ctl:setText(""),         id_ctl:setPosition(68, 12),         id_ctl:setWidth(44),         id_ctl:setHeight(18),         id_ctl:setMultiLine(),         ok_ctl := button::newOk(This),         ok_ctl:setText("&OK"),         ok_ctl:setPosition(12, 46),         ok_ctl:setSize(32, 16),         ok_ctl:defaultHeight := false,         ok_ctl:setAnchors([control::right, control::bottom]),         ok_ctl:setClickResponder(onOkClick),         cancel_ctl := button::newCancel(This),         cancel_ctl:setText("Cancel"),         cancel_ctl:setPosition(68, 46),         cancel_ctl:setSize(40, 16),         cancel_ctl:defaultHeight := false,         cancel_ctl:setAnchors([control::right, control::bottom]),         StaticText_ctl = textControl::new(This),         StaticText_ctl:setText("User ID :"),         StaticText_ctl:setPosition(12, 10),         StaticText_ctl:setSize(36, 18). % end of automatic code   end implement prime
The code as it exists today does not have any problems. If you find a way to reproduce the problem let us hear about it.
Regards Thomas Linder Puls
PDC

Harrison Pratt
VIP Member
Posts: 285
Joined: 5 Nov 2000 0:01

Re: Undeclared Identifier

Unread post by Harrison Pratt » 16 Aug 2019 12:27

"My question is why did the error yesterday refer to the setRect line as setRect/5 when the code today only has 4 arguments?."

Sometimes the dialog editor gets out of synch with the .pro file's automatically generated code after deleting some controls. If you get stuck in that error cycle just comment out the offending line of code with a leading '%' and rebuild the package containing the troublesome dialog. Right-clicking on the dialog layout tool in the dialog editor and selecting Update and View code should work, too.

When you changed the dialog size (and maybe some controls) you forced regeneration of the automatically generated code.

Loffy
Active Member
Posts: 47
Joined: 15 Aug 2019 11:32

Re: Undeclared Identifier

Unread post by Loffy » 16 Aug 2019 14:25

Thomas and Harrison,

Thanks, and understood.

Regards,

Loffy

Post Reply