Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6152987
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T20:00:59+00:00 2026-05-23T20:00:59+00:00

I am trying to underline some specific words in single line wx.textctrl. I’m doing

  • 0

I am trying to underline some specific words in single line wx.textctrl. I’m doing it by calculating position of a word in the control using GetTextExtent and drawing lines using wx.ClintDC.

My problem begins when text in TextCtrl is longer then size of the control, for example if user inputs ~100 chars he can see only 20 last characters if the control is not long enough.

My question is: how can I get a string which is actually displayed in the single line control? or how can I calculate the width of the text which is not displayed (on the left side) in pixels?

Single line text control has no scroll bar. The GetInsertionPoint returns position of caret in text, but it’s impossible to translate it to the actual distance in pixels from the left border of control.

I don’t want to use TE_RICH or TE_RICH2 styles not StyledTextCtrl class because they don’t support right-to-left text.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T20:01:00+00:00Added an answer on May 23, 2026 at 8:01 pm

    Ok, the solution I’ve found is:

    from win32api import SendMessage
    result = SendMessage(self.GetHandle(), EM_POSFROMCHAR, 0, 0)
    

    result is client coordinates of the first character in the control. The value is negative if the specified character is not displayed in the edit control’s client area.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to have a kind of dirty underline effect using a string of
Using the OpenXML SDK, 2.0 CTP, I am trying to programmatically create a Word
I'm trying to pack some unsigned int data into a string buffer created using
I'm new to using Eclipse. I'm trying to write some C++ code in it
I'm trying to center a heading (with variable width) and have the underline running
I'm trying to call a function, and VS gives me an error (red underline),
Trying to setup an SSH server on Windows Server 2003. What are some good
Trying to find some simple SQL Server PIVOT examples. Most of the examples that
Trying to make a make generic select control that I can dynamically add elements
I'm trying to develop an app for ipad and I'm using the contenteditable feature.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.