wxpython - Is it possible to draw on a TextCtrl? And if so, how? -


i'm trying elaborate textctrl line drawings: simple stuff want draw on text, next it, between lines, etc. , i'm approaching drawing in wx i've done before, on wxpanels: dcs: $dc->drawline( 15, 15, 120, 120); etc.

so far, i'm doing this: in class derived textctrl, catch evt_paint , implement own onpaint function:

sub new {      $class  = shift;      $parent = shift;       $self = $class->super::new( $parent, -1, '', wxdefaultposition, wxdefaultsize, wxte_multiline);       evt_paint($self, \&onpaint );       return $self; }  sub onpaint {     print"onpaint: @_ \n";      # @ravenspoint: there call base's paint method     # first, right? how??      $linescnt = $_[0]->getnumberoflines();          $dc = wx::paintdc->new($_[0]);         $dc->drawline(             15, 15,             120, 120         );      # commented out base class' paint method follow,     # erasing we've drawn     #   $_[1]->skip(1); }; 

now, thing is: either line or text in control drawn, when let paint event propagate or not. wx guru, might obvious, me, it's not. understand textctrl, agglomerate of wxwindow, , low level way of drawing text this, dc, , drawtext() , convenience functions on top, set caret etc.

this understanding means me: able draw, need access prepared/drawn-upon dc can on drawing onto it. right? possible, in general, , in wxperl? in function above, i'm doing paint before control draws text, that's think cause line disappearing when uncomment skip() - control clears , redraws dc.

is there way loop after textctrl has done it's drawing?

p.s.

plain textctrl seems implemented calling native text entry on platforms, although docs don't mention that.

i dug around in kephra , padre, both show "right margin indicator", thin vertical line grey, drawn onto text area. how did it? surprise: subclass wx::scintilla or older wx::styledtextctrl both offer setedgecolumn() method trigger that.

asking myself if reimplementing own text widget way access/hook drawing of text onto dc. (shaking head in disbelief)

tinkering *evt_erase_background* , richttextctrl's paintbackground() without success (well, after few minutes of hacking).

this not answer want hear, can't draw on native control (and wxtextctrl 1 such). draws , can't interfere drawing logic, considering it's different under different platforms. while can make work (especially under msw possible, i.e. you're free shoot in foot in many different ways), not guaranteed work under platforms , shouldn't @ all.

if want advanced capabilities not provided wxtextctrl, should @ wxrichtextctrl instead. implemented entirely in wxwidgets itself, i.e. not native, , can draw on it.


Comments

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -