|
-
Mar 31st, 2004, 02:36 PM
#1
Thread Starter
Hyperactive Member
Lock the Rich Text Box Control
If you use RichTextBox1.Locked = True property the RichTextBox is not totally Locked.
For example i locked the richtextbox with an image inside and i still resized the image and delete it but i couldn't type anything! Is there any way to lock Rich Text Box control in all properties?
(Text, Images etc)
-
Mar 31st, 2004, 03:31 PM
#2
I'm not in VB right now, so my info is probably faulty, but have you tried the "Enabled" property?
-
Mar 31st, 2004, 03:47 PM
#3
Thread Starter
Hyperactive Member
Enable = False property does not allow user to click on Rich Text Box and i don't want something like this! But thanks for help!
If you find something else then please send it!
-
Mar 31st, 2004, 03:57 PM
#4
-
Apr 1st, 2004, 08:13 AM
#5
Thread Starter
Hyperactive Member
I wouldn't be a good idea because it would be too slow!
Any other ideas?
-
Apr 2nd, 2004, 04:27 AM
#6
-
Apr 2nd, 2004, 07:53 AM
#7
Thread Starter
Hyperactive Member
I don't have idead for what are you talking about! I don't know this!
-
Apr 2nd, 2004, 05:40 PM
#8
-
Apr 3rd, 2004, 05:26 AM
#9
PowerPoster
I had a similar problem for a chat program that I was making, and the only solution was to enable = false it.
-
Apr 3rd, 2004, 06:51 AM
#10
Thread Starter
Hyperactive Member
Manavo11, and how to unlock it then?
-
Apr 3rd, 2004, 07:11 AM
#11
Fanatic Member
Originally posted by manavo11
VB Code:
Declare Function LockWindowUpdate Lib "user32" Alias "LockWindowUpdate" (ByVal hwndLock As Long) As Long
Pass the RTB's hwnd...
Very simple and easy to use code.
A.A. Fussy
Babya Software Group
-
Apr 3rd, 2004, 04:53 PM
#12
-
Apr 4th, 2004, 01:39 PM
#13
Thread Starter
Hyperactive Member
Thanks Manavo11! ( I am not good on API coding)
I like most the math coding!
-
Apr 5th, 2004, 04:18 PM
#14
-
Apr 5th, 2004, 05:22 PM
#15
Thread Starter
Hyperactive Member
No!!!
I have a code:
LockWindowUpdate 0& 'This for unlocking the rtb
'There is some code here...for example....
RichTextBox.SelRtf = "\b Hello\b0"
LockWindowUpdate RichTextBox.hWnd 'This for locking the rtb
But there is nowhere Hello , that it should be in the RTB!
What is the wrong in the whole thing?
I can't make it work!
-
Apr 5th, 2004, 10:36 PM
#16
PowerPoster
Fiddling with the RTF will only end in tears mate. 
Might I suggest instead,
RTB1.Selstart = whatever
RtB1.sellength = len(ofword)
RTB1.SelBold = True
-
Apr 5th, 2004, 11:31 PM
#17
You will probably need a DoEvents in there somewhere. As MartinLiss pointed out to me in another post, LockWindowUpdate will store everything that happens to the object, and once you pass 0& to LockWindowUpdate again (to 'unlock' it), all the changes that were stored will take place. Also, with LockWindowUpdate, it will automatically stop when you move the window (application window). You will need something like this:
You also may want to use UpdateWindow to unlock it, as LockWindowUpdate 0& doesn't seem to work everytime (for me anyway):
VB Code:
Declare Function UpdateWindow Lib "user32" (ByVal hwnd As Long) As Long
Phreak
Visual Studio 6, Visual Studio.NET 2005, MASM
-
Apr 6th, 2004, 07:43 AM
#18
Thread Starter
Hyperactive Member
Use the UpdateWindow decalere function with LockWindowUpdate declare function! Can i lock a RichTextBox control through UpdateWindow? Or only to unlock it?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|