How I can draw dashed line under some words in multi-lines richtextctrl ?

Are you writing your own components and need help with how to set them up or have questions about the components you are deriving from ? Ask them here.
aalsubhi
In need of some credit
In need of some credit
Posts: 5
Joined: Sun Dec 13, 2015 9:37 pm

How I can draw dashed line under some words in multi-lines richtextctrl ?

Postby aalsubhi » Sun Dec 13, 2015 9:49 pm

Hello there,
I'm using wxwidgets with python. I have been tried to draw dashed red line under some words in richtextctrl using wx.dc, but I have a problem to get the correct position of the words especially when the vertical scrollbar is enabled. Any idea to make the dashed underline possible will be appreciated.
Thanks in advanced.

User avatar
doublemax
Moderator
Moderator
Posts: 12818
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: How I can draw dashed line under some words in multi-lines richtextctrl ?

Postby doublemax » Sun Dec 13, 2015 10:12 pm

Unfortunately there is no easy solution for this. There was a similar question recently on the wx-users mailing list:
https://groups.google.com/d/msg/wx-user ... AdvgStCQAJ
Use the source, Luke!

aalsubhi
In need of some credit
In need of some credit
Posts: 5
Joined: Sun Dec 13, 2015 9:37 pm

Re: How I can draw dashed line under some words in multi-lines richtextctrl ?

Postby aalsubhi » Mon Dec 14, 2015 4:02 pm

Is it possible to use the underline feature in richtextctrl and customize it with different style and color.

aalsubhi
In need of some credit
In need of some credit
Posts: 5
Joined: Sun Dec 13, 2015 9:37 pm

Re: How I can draw dashed line under some words in multi-lines richtextctrl ?

Postby aalsubhi » Tue Dec 15, 2015 6:25 pm

can I access the underline feature in python and change the color and style of the underline?

I'm stuck in this point in my application.

Thanks in advance.

User avatar
doublemax
Moderator
Moderator
Posts: 12818
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: How I can draw dashed line under some words in multi-lines richtextctrl ?

Postby doublemax » Tue Dec 15, 2015 7:34 pm

Sorry, i don't see a solution for this unless you modify wxRichTextCtrl itself.
Use the source, Luke!

aalsubhi
In need of some credit
In need of some credit
Posts: 5
Joined: Sun Dec 13, 2015 9:37 pm

Re: How I can draw dashed line under some words in multi-lines richtextctrl ?

Postby aalsubhi » Tue Dec 15, 2015 10:34 pm

That seems more complicated. I'm not good at C++.
Is there anyway to convert the text index position to screen coordinates. I'm able to store the index of each word.

aalsubhi
In need of some credit
In need of some credit
Posts: 5
Joined: Sun Dec 13, 2015 9:37 pm

Re: How I can draw dashed line under some words in multi-lines richtextctrl ?

Postby aalsubhi » Wed Dec 16, 2015 8:48 pm

In WxPython documentation , I found this function :PositionToCoords(self, pos) which is used to converts given text position to client coordinates in pixels. I used it ,but it returned -1 that's mean the function does not success.

Any idea to use this function correctly , it will help me to draw the line in the right position.

Any help would be appreciated.

User avatar
doublemax
Moderator
Moderator
Posts: 12818
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: How I can draw dashed line under some words in multi-lines richtextctrl ?

Postby doublemax » Wed Dec 16, 2015 9:49 pm

A PositionToCoords method does not exist in the C++ part, only PositionToXY. But that returns coordinates as line and column number, not in pixel coordinates.

Try studying the code in wxRichTextCtrl::OnLeftClick in wx/src/richtext/richtextctrl.cpp. Maybe it gives you a hint about which classes / methods you can use.

But i haven't seen anything that would do what you need.
Use the source, Luke!


Return to “Component Writing”

Who is online

Users browsing this forum: No registered users and 2 guests