NO

Author Topic: Chnage Checkbox Label text under program control  (Read 3077 times)

rp108

  • Guest
Chnage Checkbox Label text under program control
« on: July 02, 2016, 03:40:13 AM »
I am using Pelles c 7.00.355 64bit
Win7 OS

I have used the Wizard to create a Dialog-based app.
I have used the drag-and-drop interface to place a Checkbox icon in my app.
Checkbox works fine, Current Label is set by Checkbox Properties dialog in the IDE.

I have been studying the MSDN Win32API to try to find how to update the label text under program control but cannot locate that.

Please, how can I assign text to different strings, during program execution?

Many thanks,
rp

Scripter

  • Guest
Re: Chnage Checkbox Label text under program control
« Reply #1 on: July 02, 2016, 04:39:49 AM »
I am using Pelles c 7.00.355 64bit
Win7 OS

I have used the Wizard to create a Dialog-based app.
I have used the drag-and-drop interface to place a Checkbox icon in my app.
Checkbox works fine, Current Label is set by Checkbox Properties dialog in the IDE.

I have been studying the MSDN Win32API to try to find how to update the label text under program control but cannot locate that.

Please, how can I assign text to different strings, during program execution?

Many thanks,
rp

In a dialog you need to first get the window handle of your control, then use the SetWindowText() api...

It goes kind of like this...
Code: [Select]
SetWindowText(GetDialogItem(hDialog, ID_CHECKBOX), "Hello World");
The dialog handle is returned by the CreateDialog() function...
https://msdn.microsoft.com/en-us/library/windows/desktop/ms645434(v=vs.85).aspx

These are the functions to change the text...
https://msdn.microsoft.com/en-us/library/windows/desktop/ms645481(v=vs.85).aspx
https://msdn.microsoft.com/en-us/library/windows/desktop/ms633546(v=vs.85).aspx

You should bookmark the MSDN site, it's a real goldmine of information.

rp108

  • Guest
Re: Chnage Checkbox Label text under program control
« Reply #2 on: July 02, 2016, 06:34:55 PM »
Thank-you Scripter !

I am studying your links now.

Yes I was actually spending hours on the MSDN site trying to find this.
I think it is my ignorance of the whole frame work and messaging pump/engine that's the reason that I can search and search and not find what I want .... sometimes I do though !

Posting a question - on this fantastic forum - is a last resort.
I try to be self sufficient.

Again, many thanks,
RP

Scripter

  • Guest
Re: Chnage Checkbox Label text under program control
« Reply #3 on: July 03, 2016, 01:05:44 AM »
Yes I was actually spending hours on the MSDN site trying to find this.
I think it is my ignorance of the whole frame work and messaging pump/engine that's the reason that I can search and search and not find what I want .... sometimes I do though !

No worries, glad to help...

Windows is some pretty weird programming, that's for sure. If you don't understand the Windows messaging system, it will never make sense to you. It's not like any other coding I've ever done. Your best bet is to take in a good tutorial or two. It sure didn't make much sense to me until I did.

This is a pretty good one to start with...
http://www.winprog.org/tutorial/


rp108

  • Guest
Re: Chnage Checkbox Label text under program control
« Reply #4 on: July 03, 2016, 03:07:40 AM »
Thanks Scripter,

I did indeed get the code running - nicely :-)

I will check out the tutorial tomorrow. Look forward to it.

Thanks again,
RP