473,385 Members | 2,243 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,385 software developers and data experts.

where is the cursor in a rictextbox???

hello,

(sorry for my english...)

I would like know if it's possible to get the position of the cursor( text
and not a mouse position!)

example: line 15, colonne 7 in my richtextbox...

thank for your help

Jean Jacques

Nov 20 '05 #1
13 1238
Jean Jacques,

I doubt that this functionality would actually make sense. If you think
about it, as this is a rich text box, the text can be different font and
sizes for each character. Therfore there can not be a persistant definition
of 'column' . Therfore I would not expect any in built function to exist.

However, you could write something yourself I suppose.

Regards - OHM
bany wrote:
hello,

(sorry for my english...)

I would like know if it's possible to get the position of the
cursor( text and not a mouse position!)

example: line 15, colonne 7 in my richtextbox...

thank for your help

Jean Jacques

Nov 20 '05 #2
* "One Handed Man" <Bo****@Duck.net> scripsit:
I doubt that this functionality would actually make sense. If you think
about it, as this is a rich text box, the text can be different font and
sizes for each character.


Mhm... It makes sense in a code editor, for example something like
VS.NET's code editor.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #3
* "bany" <ba***@ifrance.com> scripsit:
(sorry for my english...)

I would like know if it's possible to get the position of the cursor( text
and not a mouse position!)

example: line 15, colonne 7 in my richtextbox...


P/invoke on 'SendMessage' + 'EM_LINEFROMCHAR'/'EM_EXLINEFROMCHAR'.
Sorry, I don't have a sample and an idea for getting the column number
(but there is a way to do that).

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #4
In the code editor, the characters are ll in the same fonr and size.

Regards - OHM
Herfried K. Wagner [MVP] wrote:
* "bany" <ba***@ifrance.com> scripsit:
(sorry for my english...)

I would like know if it's possible to get the position of the
cursor( text and not a mouse position!)

example: line 15, colonne 7 in my richtextbox...


P/invoke on 'SendMessage' + 'EM_LINEFROMCHAR'/'EM_EXLINEFROMCHAR'.
Sorry, I don't have a sample and an idea for getting the column number
(but there is a way to do that).

Nov 20 '05 #5
* "One Handed Man [ OHM ]" <te***************************@BTOpenworld.com> scripsit:
In the code editor, the characters are ll in the same fonr and size.


Yep. And you can select a font like Courier New in a RichTextBox too.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #6
I know but you are inlikley to mix fonts and sizes, be realistic !


Herfried K. Wagner [MVP] wrote:
* "One Handed Man [ OHM ]"
<te***************************@BTOpenworld.com> scripsit:
In the code editor, the characters are ll in the same fonr and size.


Yep. And you can select a font like Courier New in a RichTextBox too.

Nov 20 '05 #7
* "One Handed Man [ OHM ]" <te***************************@BTOpenworld.com> scripsit:
I know but you are inlikley to mix fonts and sizes, be realistic !


Some text editors are based on the RichTextBox control...

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #8
I still maintain that a column by definition is a vertical line. Therfore,
'column' does not apply if they text is not lined up. If you were to say
row, this also does not apply in a RTB, because lines are wrapped, therefore
the definition of 'Row' does not apply in a RTB who's lines may wrap.
OHM


Herfried K. Wagner [MVP] wrote:
* "One Handed Man [ OHM ]"
<te***************************@BTOpenworld.com> scripsit:
I know but you are inlikley to mix fonts and sizes, be realistic !


Some text editors are based on the RichTextBox control...

Nov 20 '05 #9
* "One Handed Man" <Bo****@Duck.net> scripsit:
I still maintain that a column by definition is a vertical line. Therfore,
'column' does not apply if they text is not lined up. If you were to say
row, this also does not apply in a RTB, because lines are wrapped, therefore
the definition of 'Row' does not apply in a RTB who's lines may wrap.


You can turn off line wrapping. That's not the problem. Even if there
was line wrapping and different fonts, (idx_x, idx_y) can be used to
specify the position of a character.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #10
OK, lets say I give in on the 'Row' , a Colum is still a column. Even if
the fonts are the same, fonts which support Kerning would skew the colum
depending on the letters used.

Loosely speaking you may get "Almost Columns", but it would be better to
refer to horizontal position, not Column Number.

noun [C]
1 one of several vertical blocks of print into which a page of a newspaper
or magazine is divided:
I didn't have time to read the whole article - just the first column.
OHM


Herfried K. Wagner [MVP] wrote:
* "One Handed Man" <Bo****@Duck.net> scripsit:
I still maintain that a column by definition is a vertical line.
Therfore, 'column' does not apply if they text is not lined up. If
you were to say row, this also does not apply in a RTB, because
lines are wrapped, therefore the definition of 'Row' does not apply
in a RTB who's lines may wrap.


You can turn off line wrapping. That's not the problem. Even if
there was line wrapping and different fonts, (idx_x, idx_y) can be
used to specify the position of a character.

Nov 20 '05 #11
* "One Handed Man" <Bo****@Duck.net> scripsit:
OK, lets say I give in on the 'Row' , a Colum is still a column. Even if
the fonts are the same, fonts which support Kerning would skew the colum
depending on the letters used.

Loosely speaking you may get "Almost Columns", but it would be better to
refer to horizontal position, not Column Number.
The 3rd character in the line will still remain the 3rd character,
regardless of which font(s) is/are used to display it.
noun [C]
1 one of several vertical blocks of print into which a page of a newspaper
or magazine is divided:
I didn't have time to read the whole article - just the first column.


Mhm... For me, it doesn't matter if we are talking about rows or
columns, I think everybody understands what the OP is referring to.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #12
Actually no we dont. How do you know that he did not want to use the RTB in
some other way. he may have wanted to show a maxtrix of values for example.

And yes the 3rd character will remain the 3rd character, however the 3rd
character on the 1st row may not be in the same position as the 3rd
character on the 2nd row. In this case viewing characters 3 would not
result in a column but a skew.

Just like chr 3 remaining chr 3, a column is a column.

ENDS

Regards - OHM
Herfried K. Wagner [MVP] wrote:
* "One Handed Man" <Bo****@Duck.net> scripsit:
OK, lets say I give in on the 'Row' , a Colum is still a column.
Even if the fonts are the same, fonts which support Kerning would
skew the colum depending on the letters used.

Loosely speaking you may get "Almost Columns", but it would be
better to refer to horizontal position, not Column Number.


The 3rd character in the line will still remain the 3rd character,
regardless of which font(s) is/are used to display it.
noun [C]
1 one of several vertical blocks of print into which a page of a
newspaper or magazine is divided:
I didn't have time to read the whole article - just the first column.


Mhm... For me, it doesn't matter if we are talking about rows or
columns, I think everybody understands what the OP is referring to.

Nov 20 '05 #13
* "One Handed Man" <Bo****@Duck.net> scripsit:
Actually no we dont. How do you know that he did not want to use the RTB in
some other way. he may have wanted to show a maxtrix of values for example.
Mhm... I would not use the RichTextBox to display a matrix.
And yes the 3rd character will remain the 3rd character, however the 3rd
character on the 1st row may not be in the same position as the 3rd
character on the 2nd row. In this case viewing characters 3 would not
result in a column but a skew.
ACK.
Just like chr 3 remaining chr 3, a column is a column.

ENDS


;-)

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #14

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

Similar topics

8
by: GUEST | last post by:
Hi all. I'm a newbie to ORacle and am planning to take a course in Oracle this January. Can anyone tell me where a SQL/PL script is run from ? I tried to run a simple SQL/PL script under SQL...
9
by: heruti | last post by:
Hi all... I've been stumped by this for days. Bit of ASP code: (IIS) Set LocalConn = CreateObject("ADODB.Connection") LocalConn.CursorLocation = adUseClient LocalConn.CommandTimeout = 0...
12
by: andreas | last post by:
Hi, A button in a child form creates another form with a textbox showing with show. I set the taborder on first on this textbox in the design and set even the focus by loading but i see no...
17
by: John Salerno | last post by:
Ok, I've been browsing through the MySQLdb docs, and I *think* I know the kind of code I need to write (connect, cursor, manipulate data, commmit, etc. -- although I probably need to get more...
2
by: Lars E. Nes | last post by:
Hi all. I have a program that copies text to clibboard when the user presses a combination of SHIFT/CTRL and function keys. Now i am trying to automaticly paste that text into the textbox /...
4
by: saniac | last post by:
I am working on a little project using pysqlite. It's going to be exposed on the web, so I want to make sure I quote all incoming data correctly. However, I've run into a brick wall trying to use...
7
by: william | last post by:
My question is: Specific memory block where my pointer pointing to changed strangely, seemingly that no statement changed it. Here are two examples I got: ***********1***************** I was...
1
by: Jason Hallums | last post by:
New to Mysql; I have created a stored procedure. Using a cursor I traverse the first table. For each row in the cursor I need to determine the correct row in another table to update. Using a...
1
by: vituko | last post by:
plpgsql (postgresql 8.3 but I can upgrade) I can open a cursor with a dynamic query (table / column variable) : -open cursor for execute '...' ; But if I want do updates... - execute 'update...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.