Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How to use TabbedTextOut?

How to use TabbedTextOut?

Scheduled Pinned Locked Moved C / C++ / MFC
questiondata-structurestutorial
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    crossie
    wrote on last edited by
    #1

    LONG TabbedTextOut( HDC hDC, // handle to DC int X, // x-coord of start int Y, // y-coord of start LPCTSTR lpString, // character string int nCount, // number of characters int nTabPositions, // number of tabs in array CONST LPINT lpnTabStopPositions, // array of tab positions int nTabOrigin // start of tab expansion ); I thought the number of tabs and the positions of tabs are determined by the "\t"s contained in lpString, but it does not turn out to be that simple. What is TabbedTextOut's behavior if the number of "\t"s does not equal nTabPositons? I simiply thought that TabbedTextOut would simply replace those "\t"s in lpString with blanks and the last three parameters did not make any sense. But the fact is the width positions of these "\t"s are depent on the last three parameters. How do these three parameters work? thank you.

    D 1 Reply Last reply
    0
    • C crossie

      LONG TabbedTextOut( HDC hDC, // handle to DC int X, // x-coord of start int Y, // y-coord of start LPCTSTR lpString, // character string int nCount, // number of characters int nTabPositions, // number of tabs in array CONST LPINT lpnTabStopPositions, // array of tab positions int nTabOrigin // start of tab expansion ); I thought the number of tabs and the positions of tabs are determined by the "\t"s contained in lpString, but it does not turn out to be that simple. What is TabbedTextOut's behavior if the number of "\t"s does not equal nTabPositons? I simiply thought that TabbedTextOut would simply replace those "\t"s in lpString with blanks and the last three parameters did not make any sense. But the fact is the width positions of these "\t"s are depent on the last three parameters. How do these three parameters work? thank you.

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      crossie wrote:

      I thought the number of tabs and the positions of tabs are determined by the "\t"s contained in lpString, but it does not turn out to be that simple.

      True, the position of the tabs are determined by the values in the 7th argument to TabbedTextOut() (e.g., lpnTabStopPositions).

      crossie wrote:

      How do these three parameters work?

      Aren't the comments in your code snippet sufficient?

      "Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman

      "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

      C 1 Reply Last reply
      0
      • D David Crow

        crossie wrote:

        I thought the number of tabs and the positions of tabs are determined by the "\t"s contained in lpString, but it does not turn out to be that simple.

        True, the position of the tabs are determined by the values in the 7th argument to TabbedTextOut() (e.g., lpnTabStopPositions).

        crossie wrote:

        How do these three parameters work?

        Aren't the comments in your code snippet sufficient?

        "Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman

        "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

        C Offline
        C Offline
        crossie
        wrote on last edited by
        #3

        I think by interpreting lpString, TabbedTextOut itself can figure out how many "\t"s there are and thus the sixth parameter nTabPositions and the seventh lpnTabStopPositions, which together indicate the number and the positions of the tabs in lpString, do not make any sense. Besides, for example, when I call TabbedTextOut the following way, int nTabStopPositions[] = { 105,110,120 }; TabbedTextOut(hdc, 100, 100, "aaa\tbbb\tccc", 11, 3, nTabStopPositions, 50); Supposing the map mode is MM_TEXT,and the char width is 5. TabbedTextOut will draw the string where it is 100 pixels to the left and 100 pixels to the top of the client area, breaking the string with tabs at 100+3*5 and 100+6*5+8( a tab equals 8 blanks ). This is the way I think how TabbedTextOut works, but it seems not working that way. Thus I don't understand how the last three parameters work. thank you

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups