473,323 Members | 1,622 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,323 software developers and data experts.

Rich Text Control Causes Insanity

Here is the situation:

I am attempting to reposition a rich text control within a frame in a
running vb6 program.

What I want to do is to click on the text box then drag it to a new
position.

What happens is that the text box has a mind of its own and goes
elsewhere.

Yes, I am aware of the operation of the DragMode property. The problem
seems to be centered around the fact that the text control does not
respond to the mousedown event when DragMode is VbAutomatic. (thus
preventing the discovery of the original x and y coordinates when the
mouse is pressed)

Please, if you know how to reposition a rich text control on a frame
during runtime, let me know. My mental health is at stake here !

Regards and Many Thanks,
Jerry

Remove the obvious no spam info in my email address before emailing
me.
Jul 17 '05 #1
1 2811
Here is the situation:

I am attempting to reposition a rich text control within a frame in a
running vb6 program.

What I want to do is to click on the text box then drag it to a new
position.


Give this code a try. I handle the moving in the MouseDown event and,
since the mouse editing functionality all start with a left-mouse click,
I chose to initiate the moving with the Shift key down (you can change
that if you wish).

Rick - MVP

Option Explicit

Private Declare Function ReleaseCapture _
Lib "user32" () As Long

Private Declare Function SendMessage _
Lib "user32" _
Alias "SendMessageA" _
(ByVal hwnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
ByVal lParam As Any) As Integer

Const WM_NCLBUTTONDOWN = &HA1
Const HTCAPTION = 2

Public Sub MoveObject(hwnd As Long)
ReleaseCapture
SendMessage hwnd, WM_NCLBUTTONDOWN, HTCAPTION, 0&
End Sub

Private Sub RichTextBox1_MouseDown(Button As Integer, Shift As Integer,
x As Single, y As Single)
If Shift = vbShiftMask Then
MoveObject RichTextBox1.hwnd
End If
End Sub

Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Jim Haynes | last post by:
I cannot set the tab array for the Rich Text Box control. After I have text in the control, I try the following where rtb is the name of the rich text box control: rtb.selectall() Redim...
4
by: David Davis | last post by:
Woll2Woll has a product for Delphi called Infopower which has a rtf control with a built-in word processor. Does anyone know of a third party control that has the same capabilities. I don't have...
0
by: ray well | last post by:
hi, my app has two parallel rich text boxes containing the same content in 2 different languages. the lines parallel each other, line #3 in english contains the same content as line #3 in...
9
by: Neil | last post by:
I need to implement a rich text box in an MDB file for a user base that consists of Access 2000 and Access 2002. Unfortunately, I'm using Access 2003 on my development machine. My understanding is...
2
by: =?Utf-8?B?UmF5IE1pdGNoZWxs?= | last post by:
Hello, Sorry for the long-winded dissertation - but, I have an application where I need to write text to a rich text box using a common method, callable from anywhere in my application. The...
5
by: ARC | last post by:
Just found out something interesting with Access 2007... In table design, if you set a memo field to the new rich text option, and put that control on a form, set the control to rich text, you can...
4
by: Neil | last post by:
Just found out that the Microsoft Rich Textbox does not support full text justification, since it's based on Version 1.0 of the RichEdit Window Class, and full text justification is only available...
16
by: Neil | last post by:
I posted a few days ago that it seems to me that the Access 2007 rich text feature does not support: a) full text justification; b) programmatic manipulation. I was hoping that someone might...
0
by: Wayne | last post by:
In Access 2007 is there any workaround or fix for the bug in rich text boxes on subforms that causes the mini formatting toolbar to not function?
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.