That's certainly one way to do it, and for small amounts of text, it will be quite suitable. For large amounts of text, there are better ways to track selection.

I'm presently working on a text editor. I was looking for a decent replacement for the RB editfield for a while, and decided I was going to have to embark on my own.

I'm also going to be working on a selectable static text too, perhaps I can post that when I've got it together.

- Ryan Dary

Phil M wrote:
On Sep 24, 2006, at 6:26 PM, Ryan Dary wrote:

It wouldn't be too difficult to just make a canvas-based control that does what a static text does, and then add the selection functionality. Let me know (off list) if you need any help.


Drawing the control, no it wouldn't be hard at all. What is more difficult is tracking selection for individual characters... especially in cases where:

   (g.StringWidth("i") + g.StringWidth("t")) <> (g.StringWidth("it")

I cannot imagine how many possible variables it would be to make a text editor based on a Canvas. I know it can be done because I have seen other REALbasic applications with Canvas-based editors. If I get character selection working, the only thing missing from a text editor would be the keyboard input.

So how would you do it?

Would you start at the beginning of the line and test StringWidth for the phrase up until that character? And then the first character past "x" is the clicked character?

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to