Discussions related to Visual Prolog
ludieter
Posts: 23
Joined: 21 Dec 2010 19:40

Problems with editor controls

Unread post by ludieter »

Upon switching from 7.4 to 7.5 I find that the command
myedit_ctl:setReadOnly(false)
does not work anymore (does not let me edit...)

After trying various things I decided to do use the scilexer control. Switching to/from readonly works as expected. On setting the proprerty of horzontal scroll bar to false, however, I get an error:

Exception: singleFactHasNoValue (runtime_exception)

Single fact has no value

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

How can I fix this?
User avatar
Thomas Linder Puls
VIP Member
Posts: 1398
Joined: 28 Feb 2000 0:01

Unread post by Thomas Linder Puls »

We will investigate the edit control problem.

Exceptions like that comes when trying to manipulate a control that have not really been created yet.

In PFC GUI you have objects representing the widows on the screen, but the objects exist before and after the actual windows. The real windows are created on "show". For some things in some controls we have implemented things, so that it works before the control is really created.

The simplest way to postpone control manipulation to after control creation is to attach a "show" listener:

Code: Select all

clauses     new(...) :-         ...         addShowListener({ :-             %This will happen when the controls "are about to be shown"             myEdit_ctl:doSomething(...)         }).
Regards Thomas Linder Puls
PDC
User avatar
Thomas Linder Puls
VIP Member
Posts: 1398
Joined: 28 Feb 2000 0:01

Unread post by Thomas Linder Puls »

We have not been able to reproduce a problem with editControl::setReadOnly, are you using build 7501?

IDE: Web -> Check for updates....
Regards Thomas Linder Puls
PDC
ludieter
Posts: 23
Joined: 21 Dec 2010 19:40

Unread post by ludieter »

build is 7501 commercial. The program worked in 74, not in 75.

To make sure I wasn't doing something I wasn't aware of, I made a program only opening a window with one edit control and two buttons, one to set readonly one setting readonly(false)...
ludieter
Posts: 23
Joined: 21 Dec 2010 19:40

Unread post by ludieter »

will try adding showlistener with the scilexer control and get back to you
Thx
Dieter
User avatar
Thomas Linder Puls
VIP Member
Posts: 1398
Joined: 28 Feb 2000 0:01

Re:

Unread post by Thomas Linder Puls »

ludieter wrote:build is 7501 commercial. The program worked in 74, not in 75.

To make sure I wasn't doing something I wasn't aware of, I made a program only opening a window with one edit control and two buttons, one to set readonly one setting readonly(false)...
Could you show the code?
Regards Thomas Linder Puls
PDC
ludieter
Posts: 23
Joined: 21 Dec 2010 19:40

Unread post by ludieter »

I tried to upload a zip file (6mB) with the whole project, but I get an error "tried to upload an empty file". I saw the upload on the status bar though. Is the file too large?

Here files except folders deb / obj / exe
Attachments
readonly.zip
(21.33 KiB) Downloaded 453 times
User avatar
Thomas Linder Puls
VIP Member
Posts: 1398
Joined: 28 Feb 2000 0:01

Unread post by Thomas Linder Puls »

Thank you!

You can solve the problem if you change the implementation of editControl::setReadOnly like this:

Code: Select all

clauses     setReadOnly(B) :-         if isShown() then             _ = sendMessage(em_setreadonly, if true = B then gui_api::wTrue else gui_api::wFalse end if)         else             setStyleBoolean(es_readonly, B)         end if.
You will most likely need to start the IDE in Administrator mode to edit the file (if you have installed in the default location).
Regards Thomas Linder Puls
PDC
ludieter
Posts: 23
Joined: 21 Dec 2010 19:40

Unread post by ludieter »

Thanks Thomas! Works like a charm.
Post Reply