trackBar Scroll value?

  • Thread starter Thread starter Geoff Cox
  • Start date Start date
G

Geoff Cox

Hello,

I am using Visual C++ 2005 Express Beta 2 and cannot sort out how to
use the Scroll property value for a trackBar.




Under Event properties the name for the Scroll property is
trackBar1_Scroll so how do I print out the Scroll value?

I have tried using

Console::WriteLine(trackBar1_Scroll.Value);

but get error message

error C2228: left of '.Value' must have class/struct/union

if I use

Console::WriteLine(trackBar1_Scroll->Value);

I get

error C2228: left of '.Value' must have class/struct/union/generic
type

As you will see I do not know what I am doing! Any help would be much
appreciated. I have found 2 books but they are not published until
October/November. Any ideas for a good site which addresses this
language?

Cheers

Geoff
 
Geoff said:
I am using Visual C++ 2005 Express Beta 2 and cannot sort out how to
use the Scroll property value for a trackBar.

TrackBar has an event called Scroll. When you double click on it, the
IDE creates a member function for you, named trackBar1_Scroll. It's a
function, known as the event handler. Inside the body of the function
you write the code that need to be executed when the track bar's thumb
is moved.

Now you want to print the position of the track bar, which is accessed
via the track bar's Value property. The Value has nothing to do with
Scroll. Whether you scroll or not, the Value contains the current position.

So in the event handler type the following:

private: System::Void trackBar1_Scroll(System::Object^ sender,
System::EventArgs^ e)
{
Console::WriteLine(trackBar1->Value);
}

Hope this helps,
Tom
 
TrackBar has an event called Scroll. When you double click on it, the
IDE creates a member function for you, named trackBar1_Scroll. It's a
function, known as the event handler. Inside the body of the function
you write the code that need to be executed when the track bar's thumb
is moved.

Now you want to print the position of the track bar, which is accessed
via the track bar's Value property. The Value has nothing to do with
Scroll. Whether you scroll or not, the Value contains the current position.

So in the event handler type the following:

private: System::Void trackBar1_Scroll(System::Object^ sender,
System::EventArgs^ e)
{
Console::WriteLine(trackBar1->Value);
}

Hope this helps,

Tam,

I should have read this before posting my other message to you! I
understand why I must use trackBar1->Value - thanks for that.

I am trying to work out how to make a button invisible.

button1->Visible(false);

is not correct - hwo do I do this?

Cheers

Geoff
 
Back
Top