Dynamic label text?
-
Well, I'm new to C++ and I think I'm missing something obvious. I'm trying to create a text label control on a form, but I want the actual text to be dynamic (I want to use a variable that I can change on-the-fly). So where I'd normally have something like this: this->labelDynamicText->Name = L"labelDynamicText"; this->labelDynamicText->Size = System::Drawing::Size(145, 34); this->labelDynamicText->TabIndex = 5; this->labelDynamicText->Text = L"This is some dynamic text"; I was thinking of something like this: this->labelDynamicText->Name = L"labelDynamicText"; this->labelDynamicText->Size = System::Drawing::Size(145, 34); this->labelDynamicText->TabIndex = 5; this->labelDynamicText->Text = MyDynamicText; and I'd be able to something like: int intCount = 0 Do Until [intCount = 60] MyDynamicText = "this text sits on the screen for a few seconds" intCount = intCount + 1 Loop MyDynamicText = "this text displays after 60 seconds" So can anyone help guide me in the right direction? Can I easily do this, and where do I start? Thanks in advance!
-
Well, I'm new to C++ and I think I'm missing something obvious. I'm trying to create a text label control on a form, but I want the actual text to be dynamic (I want to use a variable that I can change on-the-fly). So where I'd normally have something like this: this->labelDynamicText->Name = L"labelDynamicText"; this->labelDynamicText->Size = System::Drawing::Size(145, 34); this->labelDynamicText->TabIndex = 5; this->labelDynamicText->Text = L"This is some dynamic text"; I was thinking of something like this: this->labelDynamicText->Name = L"labelDynamicText"; this->labelDynamicText->Size = System::Drawing::Size(145, 34); this->labelDynamicText->TabIndex = 5; this->labelDynamicText->Text = MyDynamicText; and I'd be able to something like: int intCount = 0 Do Until [intCount = 60] MyDynamicText = "this text sits on the screen for a few seconds" intCount = intCount + 1 Loop MyDynamicText = "this text displays after 60 seconds" So can anyone help guide me in the right direction? Can I easily do this, and where do I start? Thanks in advance!
Off topic: Please use <pre></pre> tags around your code (use the code block button above) rather than bolding. On topic : Changing the contents of your
MyDynamicText
variable does not force it to refresh the label on your form. You also need to resend it tothis->labelDynamicText->Text
as was done in the initialisation. Note also that your counter will run very fast rather than taking 60 seconds, you probably need to use a timer orsleep()
call.It's time for a new signature.