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. Mobile Development
  3. Mobile
  4. WM5 development C++ - set up GUI

WM5 development C++ - set up GUI

Scheduled Pinned Locked Moved Mobile
c++helpcsharpjavahardware
5 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.
  • U Offline
    U Offline
    uzziah0
    wrote on last edited by
    #1

    I'm new to WM development, but I know C (mostly embedded, but also LabWindows/CVI). (I think I'm developing in MFC -- not exactly sure how that works even thought Joel gave me a good description in another forum.) So, I'm all good with the straight C type stuff, I've opened and read a file, save the data from it in an array. The problem I'm having is finding something to help get me going in a direction to display the data on the screen. What I'd ultimately like to do is have a check box for each line and then two more columns of text from the file (two words, one for each column), sort of like a table. Like this: Check Box First Second x this that x some something I have searched MSDN, but I can't find anything that is straight forward (like CreateWindow(), CreateTable(), and FillCell()). I've searched for a C++ sample, but nothing seems to spring out that is doing anything like this that I can find, everything I've found is displaying pictures, or is in C# or using Classes (which seems too complicated for what I am trying to do). Any hints as to what I can look at to get going in the right direction, or some sample code that I can experiment, or even some functions I can search MSDN for would be greatly appreciated. Thanks

    J 1 Reply Last reply
    0
    • U uzziah0

      I'm new to WM development, but I know C (mostly embedded, but also LabWindows/CVI). (I think I'm developing in MFC -- not exactly sure how that works even thought Joel gave me a good description in another forum.) So, I'm all good with the straight C type stuff, I've opened and read a file, save the data from it in an array. The problem I'm having is finding something to help get me going in a direction to display the data on the screen. What I'd ultimately like to do is have a check box for each line and then two more columns of text from the file (two words, one for each column), sort of like a table. Like this: Check Box First Second x this that x some something I have searched MSDN, but I can't find anything that is straight forward (like CreateWindow(), CreateTable(), and FillCell()). I've searched for a C++ sample, but nothing seems to spring out that is doing anything like this that I can find, everything I've found is displaying pictures, or is in C# or using Classes (which seems too complicated for what I am trying to do). Any hints as to what I can look at to get going in the right direction, or some sample code that I can experiment, or even some functions I can search MSDN for would be greatly appreciated. Thanks

      J Offline
      J Offline
      Joel Ivory Johnson
      wrote on last edited by
      #2

      I keep thinking what you are describing is best served by a ListView in detail mode with a checkbox, but I can't find my MFC reference to verify this. But I am sending this message just so that you know I will look into this question.

      Joel Ivory Johnson

      Meet my dev team: RDA Architecture Evangelist Team Blog

      My site: J2i.net

      Twitter: J2iNet

      U 1 Reply Last reply
      0
      • J Joel Ivory Johnson

        I keep thinking what you are describing is best served by a ListView in detail mode with a checkbox, but I can't find my MFC reference to verify this. But I am sending this message just so that you know I will look into this question.

        Joel Ivory Johnson

        Meet my dev team: RDA Architecture Evangelist Team Blog

        My site: J2i.net

        Twitter: J2iNet

        U Offline
        U Offline
        uzziah0
        wrote on last edited by
        #3

        I found an example that I'm trying to use for a reference, but it is doing stuff with pictures, and I just want to display text. It is using the following functions: BeginPaint() LoadString() SHLoadImageResource() CreateFontIndirect() GetClientRect() DrawText() GetClientRect() DrawText() EndPaint() There is a little more, but I think this is the gist of writing to the screen. In tinkering with this example, I keep breaking it trying to figure out which parts are the parts that write just the text; while not displaying the image. The code I'm using (I can't remember where I found it, it might have been here, but I can't find it again) displays a picture with a text caption under it. I'm trying to see how the text part works byt removing the image part, so it just displays the caption. When I do it, I get the caption with the first picture, but not the second picture. The screen is just blank.

        U 1 Reply Last reply
        0
        • U uzziah0

          I found an example that I'm trying to use for a reference, but it is doing stuff with pictures, and I just want to display text. It is using the following functions: BeginPaint() LoadString() SHLoadImageResource() CreateFontIndirect() GetClientRect() DrawText() GetClientRect() DrawText() EndPaint() There is a little more, but I think this is the gist of writing to the screen. In tinkering with this example, I keep breaking it trying to figure out which parts are the parts that write just the text; while not displaying the image. The code I'm using (I can't remember where I found it, it might have been here, but I can't find it again) displays a picture with a text caption under it. I'm trying to see how the text part works byt removing the image part, so it just displays the caption. When I do it, I get the caption with the first picture, but not the second picture. The screen is just blank.

          U Offline
          U Offline
          uzziah0
          wrote on last edited by
          #4

          FYI: OK, I got through this, and I am drawing rectangles and filling with text

          fbrush = CreateSolidBrush(bcol);
          FillRect(ps.hdc, &rect, fbrush);
          wsprintf(szLabel, TEXT("Remove"));
          rect.top += 2;
          rect.left += 2;
          DrawText(ps.hdc, szLabel, -1, &rect, DT_LEFT | DT_NOPREFIX | DT_SINGLELINE);

          This is creating a rectangle on the screen, filling it with a specified color, and writing the text "Remove" in the rectangle. The problem I was having was the code I was refering to had an image that it was displaying with text under it. I had problems figuring out what was the image part and what was the text part. I basically just looked at the functions, and read about them at MSDN, and created what I have above. The one thing I can't figure out is the background color for the text. The rectangles I'm using are filled with a background color, but the text background fills with white. I have not been able to find where to change that, there does not seem to be an option for DrawText. Anyone know?

          U 1 Reply Last reply
          0
          • U uzziah0

            FYI: OK, I got through this, and I am drawing rectangles and filling with text

            fbrush = CreateSolidBrush(bcol);
            FillRect(ps.hdc, &rect, fbrush);
            wsprintf(szLabel, TEXT("Remove"));
            rect.top += 2;
            rect.left += 2;
            DrawText(ps.hdc, szLabel, -1, &rect, DT_LEFT | DT_NOPREFIX | DT_SINGLELINE);

            This is creating a rectangle on the screen, filling it with a specified color, and writing the text "Remove" in the rectangle. The problem I was having was the code I was refering to had an image that it was displaying with text under it. I had problems figuring out what was the image part and what was the text part. I basically just looked at the functions, and read about them at MSDN, and created what I have above. The one thing I can't figure out is the background color for the text. The rectangles I'm using are filled with a background color, but the text background fills with white. I have not been able to find where to change that, there does not seem to be an option for DrawText. Anyone know?

            U Offline
            U Offline
            uzziah0
            wrote on last edited by
            #5

            OK, a little more searching and I found this:

            SetBkMode(ps.hdc, TRANSPARENT);

            to make the text background transparent. I thought it would be part of the Font or DrawText.

            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