| [ Return to Bugs & Features | Roadmap 1.1 | SVN ⇄ GIT ]
STR #322
Application: | FLTK Library |
Status: | 1 - Closed w/Resolution |
Priority: | 4 - High, e.g. key functionality not working |
Scope: | 3 - Applies to all machines and operating systems |
Subsystem: | Core Library |
Summary: | Cannot force text selection with Fl_Text_Display |
Version: | 1.1.4 |
Created By: | jedimasterthrash |
Assigned To: | mike |
Fix Version: | 1.1.5rc1 |
Update Notification: | |
Trouble Report Files:
Trouble Report Comments:
|
#1 | jedimasterthrash 17:06 Mar 21, 2004 |
| When you display text using an Fl_Text_Display, you can select text by dragging the mouse. The text appears highlighted from the selection. However, if you try to manually select text in the Fl_Text_Buffer associated with the Fl_Text_Display using the select() method, the text does not appear highlighted.
The same thing happens the highlight() method. If you force a highlight on the Text_Buffer associated with an Fl_Text_Display, the highlight does not get displayed. However, if you manually select all the text with the mouse, and then unselect it, the highlight is now drawn (magically appears). So this would definitely seem like there's a problem with redraw. Manually calling redraw(), redisplay_range(), and damage() have no change on the behavoir for either highlight() or select().
I traced what happens when you drag a mouse, and the mouse drag results in calling select() on the text_buffer, so functionally it should work. I've been trying to figure out why it's not working for hours. I think it has something to do with redraw not redisplaying the highlight, or possibly losing the highlight with a focus change.
If you use the identical code on an Fl_Text_Editor, the forced selection works as expected.
Example: Fl_Double_Window *pDW = new Fl_Double_Window(400, 400); Fl_Text_Display *pTD = new Fl_Text_Display(100, 100, 200, 200); Fl_Text_Buffer *pTB = new Fl_Text_Buffer(); pTD->buffer(pTB); pTD->end(); pDW->end(); pTB->append("blah\nblah\nblah\n"); pTB->select(5, 9); pDW->show(); return Fl::run();
In the meantime, if this cannot be resolved quickly, is there I way that I can use a Fl_Text_Editor, but make it "display-only", ie, the user can't add text to it (without having to override every single possible way to add text in the handle() method).
Thanks, Ash.
| |
|
#2 | mike 07:46 Apr 06, 2004 |
| I will see if I can track this issue down.
As for alternatives, there are none short of subclassing Fl_Text_Editor. | |
|
#3 | mike 07:58 Apr 06, 2004 |
| See attached patch; basically, the display widget doesn't have focus so it wasn't highlighting; I updated it to partially highlight it (mix of the color() and selection_color()) when it doesn't have focus. | |
|
#4 | mike 07:58 Apr 06, 2004 |
| Fixed in CVS - the anonymous CVS repository will be updated at midnight PST. | |
[ Return to Bugs & Features ]
|
| |