Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

software platform - button color and animation

1. I tried this example to make my button blink but it didn't worked.
.
m_btnCal[i].OnImages(1).BlinkInterval = CNiImage::SpeedFast;

2.  The usage of SetOnColor/ SetOffColor are not clear.

I used decimal values in the argument.  The colors appeared were black, blue and grey.  Plus , there is no guideline or lookup table to refer to the color so I did a lot of trial and error.  I spent so much time for few buttons alone.  

I tried the hex values from the COLOREF and by using the SetOnColor()  and it did worked. But using the SetOffColor() was unsuccessful.
I also tried setting a different color from my on and off colors but i would appear as a different color.
 
Is there a heirachy in the button control properties? 
Illustration:
m_btnCal[i].Value = true;
m_btnCal[i].SetOnColor(0x00FF);
m_btnCal[i].SetEnabled(1);

Rearranging the above properties would give me a different color from my expectation.
Say, if I achieved the desired color and I use the same pattern/ sequence to other parts of the program, the color is not
consistent.

3. What is the difference between the set color commands from the get color commands?  I didn't any difference when
I tried both.


Please give button color and animation guidellines and examples .
Regards,
Angel
0 Kudos
Message 1 of 4
(3,555 Views)
Angel,

I am investigating these questions and will post the answers soon.  Can you tell me the class of your m_btnCal[i] member?
Regards,


Marty H.
National Instruments
0 Kudos
Message 2 of 4
(3,516 Views)
Hello Marty,

My class is derived from CDialog.

I called a local NI support few days ago and received an example.
m_btn.OnImages(5).BlinkInterval::CNiButton.SpeedFast;

while the meas studio help is:
m_btn.OnImages(1).BlinkInterval::CNiButton.SpeedFast;

I used the meas studio help ex and didn't worked because i didn't have a caption to begin with.
I noticed that the paramater of the OnImages/OffImages is a constant that
corresponds to the sequence of the valid image name.
In this order, the valid image names would be:
1. Caption
2. ?  ( sorry I have no meas studio help as of this writing )
3. ?
4. ?
5. Image - the actual button is referred as image

My comment about the meas studio ex is unclear because the valid image names are not referred
as list or enum(perhaps) so that the user can access by using a constant or object name.

Anyway, regarding this, aside from blink control my program comes with the on/off color control.
I normally use these set of commands altogether.

m_btn.Value = 1;
m_btn.OnImage(5).BlinkInterval::CNiButton.SpeedFast;
m_btn.OnColor(0xFF00);  //based from coloref
m_btn.SetEnabled(1);

in the properties dialog box, the offcolor = red while oncolor = green.
Then, I have a 3rd color yellow.  As long as  I achieve my desire color, I would
rearranging the commands, add some or subtract some. The priority is not clear as well.
 I only base the results from a series of trial and error.  The same sequence and combination
used in several function calls didn't exhibit same results.

I'd like to ask for guidelines and examples for consistency and generate predicatable results.


Thanks a bunch,

0 Kudos
Message 3 of 4
(3,510 Views)
Hello Angel,

I found a couple of articles in the NI Measurement Studio Help that discuss control animations and colors.  Both of these pages should be helpful.  You will have to paste the following addresses into the URL field in Visual Studio Help.

ms-help://MS.VSCC.v80/MS.VSIPCC.v80/NI.MeasurementStudio.2005/NIVCUIConcept/XML/Animating_MStudio_VCControls.html
ms-help://MS.VSCC.v80/MS.VSIPCC.v80/NI.MeasurementStudio.2005/NIVCUIConcept/XML/Customizing_Colors_ButtonControl.html


When you set the OnColor and OffColor, you should pass RGB decimal values between 0 and 255 in conjunction with the CNiColor() function as demonstrated below:

m_button.OnColor = CNiColor(0,255,0);


The SetColor commands are different from the GetColor commands in that the SetColor commands specify a certain color that will be used for a control, whereas the GetColor commands return the color that is currently being used for that control.
Regards,


Marty H.
National Instruments
0 Kudos
Message 4 of 4
(3,501 Views)