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

C# Extended Text Editor

Hi,

Does anyone know how I can go about the following? I want to write a
custom control that will probably extend from the textbox control that
enables the user to insert some pre-defined fields into the text
whenever they right-click at the selected point. I know you can
determine the co-ordinates of a DataGridView using the HitTestInfo
method, but is there a similar method for the textbox control?

I would like it so that the field is somehow "protected" - i.e. the
user can't edit the information within the field, they can only delete
the field. Does that make sense?

If there are any articles, code sources etc that I can be directed to,
it would be much appreciated.

Many thanks

Andy

Apr 26 '06 #1
1 1612
The text box has a SelectionStart property, if no text is selected it will
tell you the current position of the cursor within the text box.

You could of course use the mouse up event to detect a right click, then pop
up a menu.

Protecting the field gets a lot trickier. You'll have to constantly monitor
the cursors current position and examine the text on / around that position.
If it's one of your predefined tags, you'd have to set the Selection Length
to the length of the tag, or auto move the selectionstart to just past the
tag. Also you'd have to intercept the keypress event to make sure user
didn't type something while in the field. Either that or always move the
cursor to either side of the field, never let him land right in a tag.

Lots of events you'd have to code up, but could be done if you had to roll
your own. I bet in a long week you could have something working. Can't say
I've seen an off the shelf package though that will do what you ask.

Robert
http://n4ixt.blogspot.com
"foolsbar" <fo******@yahoo.com> wrote in message
news:11*********************@v46g2000cwv.googlegro ups.com...
Hi,

Does anyone know how I can go about the following? I want to write a
custom control that will probably extend from the textbox control that
enables the user to insert some pre-defined fields into the text
whenever they right-click at the selected point. I know you can
determine the co-ordinates of a DataGridView using the HitTestInfo
method, but is there a similar method for the textbox control?

I would like it so that the field is somehow "protected" - i.e. the
user can't edit the information within the field, they can only delete
the field. Does that make sense?

If there are any articles, code sources etc that I can be directed to,
it would be much appreciated.

Many thanks

Andy



----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= East/West-Coast Server Farms - Total Privacy via Encryption =---
Apr 26 '06 #2

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

Similar topics

11
by: Ed Suominen | last post by:
I'm thinking of implementing a real-time collaborative text editor in Python using Twisted. An initial plan is to use a Twisted PB server daemon that accepts user:password:file connections from...
4
by: Edward K. Ream | last post by:
Various documentation pages, e.g. http://www.python.org/doc/2.3.3/lib/non-essential-built-in-funcs.html state that the apply function has been deprecated since 2.3. Can anyone tell me when...
4
by: Vincent Lefevre | last post by:
Hello, The XPath 1.0 recommendation says: A number represents a floating-point number. A number can have any double-precision 64-bit format IEEE 754 value . These include a special...
1
by: | last post by:
Hey all, Quick question...been bugging me for some time, really. I have a console app, it does some things, and I want to save an array of text to a text file. The text consists of ASCII and...
1
by: IkBenHet | last post by:
Hello, I found this script to create a simple rich text form (http://programmabilities.com/xml/index.php?id=17): <html> <head> <title>Rich Text Editor</title> </head> <body>
13
by: kristofvdw | last post by:
Hi, I have to treat a given text file, but haven't got a clue which extended ASCII set it is using. Opening the file in Windows' Notepad or in DOS, all accented letters and symbols are wrong....
0
by: jygoh3 | last post by:
ENCYCLOPEDIA OF MOBILE COMPUTING & COMMERCE CALL FOR SHORT ARTICLES Proposal Deadline: 15 Nov 2005 (Extended)
1
by: Fabian_20 | last post by:
Hello everybody, sry for the bad title :). I created an extended ListView with an extended ColumnHeader. If i add a new ColumnHeader through the designer, it appears on the left side of the...
3
by: danesh1354 | last post by:
Hi All, First I need to construct a text editor by python programming and add this code to a biger code that has been written before, and i would like that by my code for this editor have a...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.