Problem: Getting error "An error occurred when setting the property named 'Frame.Style' of the object named 'Genre1' of type 'Field'".
"Attempted to assign an illegal value to the property.",
when running a form and changing the framestyle for the active object.
Date: 15 Nov 2002
Versions: All (?). Tested in P9 and later.
Description by: Luuk Houwen < luuk.houwenNO@JNKt-online.de >
A field in a tableframe is highlighted with a frame when the mouse passes over it. This works fine, except when the cursor is also on that field, in
that case I get an error message: "An error occurred when setting the property named 'Frame.Style' of the object named 'Genre1' of type 'Field'".
"Attempted to assign an illegal value to the property.".
The tableframe contains a field called ID which shows the recordID. Added to MouseEnter of that field is library code that switches the frame
on:
lib.setFrameOn()
The actual library code is:
self.Frame.Style = SolidFrame
MouseExit of the same field has a similar reference to the library that switches the frame off again
self.Frame.Style = NoFrame
For the error message to appear the table does not need to be in edit mode at all. It suffices if the cursor is on the field and I then move the
mouse _to that same field_. No error messages appear when the mouse is moved over the field in other records.
There are a few prerequisites:
1. you _must_ move the cursor to the relevant field with the cursor keys, not by using the mouse
2. the field _must_ have its design property Size to fit switched off
If either one of these conditions is not met, I have no problems with the field either.
Solution:
Don't do it when field has focus.
if not self.focus then
self.Frame.Style = SolidFrame
endif