Użytkownik OKB (not okblacke) napisał: > Hi. I'm trying to create an edit box that only allows certain > kinds of editing, specifically adding and removing newlines. I thought > I could do this by trapping all non-control keys and eating the events, > then trapping backspace and delete and looking at the characters next to > the insertion point. However, it doesn't seem to work, because I can't > reliably use my dEditBox.InsertionPosition as an index into the Value. > > I suspect this may be because the newlines are somehow being stored > as \r\n, which is two characters -- it looks like the insertion position > gets incremented by TWO (not one) if I move the cursor across a line > break. However, I can't see any way to compensate for this other than > counting the number of line breaks from the start of the text to the > insertion point, and adjusting the index by that much. Needless to say, > that seems pretty silly. Isn't there a way to get a dEditBox to tell me > what character is at (i.e., just before or just after) the insertion > point? >
Hi. It's by design. Use GetRange <http://xoomer.virgilio.it/infinity77/wxPython/Widgets/wx.TextCtrl.html#GetRange>() method instead of applying substring positions to Value property. -- Regards Jacek Kałucki _______________________________________________ Post Messages to: [email protected] Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users Searchable Archives: http://leafe.com/archives/search/dabo-users This message: http://leafe.com/archives/byMID/[email protected]
