rich text control and locking issue

M

milkmoney1970

Greetings All,

I wonder if anyone has run across this issue. I am using Stephen
Leban's rich text control, which as I've mentioned in another post, is
fantastic. But I'm having a strange issue when trying to lock the
control.

When I set the control to locked, you can hit almost any key - with
your cursor in the control - and nothing will happen - this of course
is what it want. However, if you hit the key for the letter 'c' it
will enter a 'c' into the control, while it is locked. You can't
delete the letter 'c' but you seem to be able to enter as many 'c's as
you would like.

I can't quite figure out what might be causing this, or if it is a
strange interaction between the rich text control and Access 2007.
Anyone, had experience with this?

Thanks in advance.
 
S

Stephen Lebans

Did you follow the instructions on the RTF2 Web page for Locking the RTF2
control?
Why can't I use Access's Enabled and Locked properties for the RTF2 Control.

I spent tens of hours on this issue before I finally across a reference to
this issue on the FMS site. The FMS control does not support the native
Access control Enabled or Locked properties. Instead Enabled and Locked
properties are exposed by the ActiveX control directly. What does this mean
to you. Well, assuming your RTF2 control is named "RTF2" then to set the
Enabled or Locked properties you would use code like:

Me.RTF2.Object.Enabled = False


--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 
M

milkmoney1970

Hi Stephen,

Yes, I did read carefully and followed your directions by using the
format you suggest below - in my case: cntx.object.locked = True.

But here is the strange bit. At first it appears to be locked. If I
put my cursor in to test it and start trying to type, nothing happens,
which led me to believe that it had worked. But on closer
inspection....

The problem is two-fold. First, when I, quite accidentally while
testing all the keys, hit the 'c' key, it entered a 'c', but all other
key strokes appear to be locked out. Only 'c' affects the field. Enter
the Twilight Zone music.

The second strange thing is that on my machine, it behaves in the way
you expect the locked function to work (except for the strange thing
about the key 'c') but on another computer, the field can be edited in
all ways a non-locked control would behave. At first I thought it was
an issue with runtime versus full version Access, but I tried the
runtime version on my computer at it behaves as noted above.

Can you envision anything that might cause this? Could it be a
conflicting reference or something?

Thanks again.
 
S

Stephen Lebans

I do not have A2007 installed. On A2000 through 2003 I cannot duplicate that
behaviour here.

Are you setting both properties:
Me.RTFcontrol.Object.Enabled = False
Me.RTFcontrol.Object.Locked = True

Does the control's background color change to the default grey of a locked
control?

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 
M

milkmoney1970

Hi Stephen,

Well, as usual you nailed it on the head. When I read your directions
for setting the locked property, I misunderstood. I thought this quirk
applied both to .locked and .enabled but did not understand that
both .locked and .enabled had to be set to "True" and "False",
respectively for locking to work. Oh well, maybe this post will help
others if they don't understand how to implement this.

Thanks again for your help.
 
M

milkmoney1970

Just a follow up question related to the locking or the rtf
control....

I would like the user to be able to use the scroll bar to scroll
through the text of a locked control (just don't want them to be able
to edit the text). Is there any way to accomplish this since I would
have to disable the control as part of locking it?

Thanks again.
 
S

Stephen Lebans

I honestly do not know. Have you tried setting just the Disabled prop and
not the Locked prop or vice versa?

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top