RichEdit/xControls issues
- Posted by "Christian Cuvier" <christian.cuvier at agriculture.gouv.fr> Jan 26, 2005
- 602 views
Hi! I did not stop rewriting a Syntax2.ew syntax control with bookmarks and text folding, but I'm hitting a wall erected by Windows. Because some text in the file shouldn't be displayed, as it relates to the above features, I can't call the default processing for painting, as in the current Syntax. This works, including painting the selected and [un]folded areas. The problem is that the RichEdit control, when responding to navigation keys, displays the caret according to some internal info that is not updated when changing font. Creating the caret with the right dimensions on w32HActivate or w32HPaint doesn't help. Thus, for instance, the caret moves by 9 pixels up and down even though the font size was set to 18 (characters entered display with the right font however). Looks like this aspect remains stuck to default parameters if the default painting is not used. As I'm writing this post, I realize that calling the default processing to paint on font change, then clear window and redraw my way might work, I have to test this. There are several options out, so I'm asking the (future) users of Syntax here: 1/ Use the CFM_HIDDEN attribute to hide unwanted text. That may be a bit slow, and won't work with RichEdit v2.0 or less, which could be an issue on Win95/98 systems. 2/ Create a new control on font change, and route events so that win32lib still believes the original id is alive. Drawback is that the undo stack is lost in the process. 3/ Create the control from scratch, handling everything from selection to undoing and stuff. This has some good aspects, as the RichEdit interface has some backward compatible quirks I can get rid of. I started going that route, but obviously it's a tremendous amount of work, so that the release date would be quite later than expected. None of the above is needed if the trick I mentioned works as expected, but there's hardly any guarantee it does. Whichever option is taken, the new control would have to include xControls.e so as to register as a custom control. This approach would work for all of the xControls collection, allowing them to be used independently; this change avoids loading heaps of unused code, which is a factor in Eu2.5 (even though the beta version improved things a lot). win32lib does have an undocumented mechanism for registering custom controls, but some of its routines are not coded to support custom controls known by interface only. The days it fully works, Syntax2.ew can live without xControls.e. What do you think? Greg (or Don), you have a special vote to cast on this, of course ... CChris