Beijer Electronics (formerly QSI Corporation)

Manufacturer of Mobile Data and Human Machine Interface Terminals.
It is currently Wed Nov 22, 2017 5:39 am

All times are UTC - 7 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: SliderV2 Button tracking
PostPosted: Tue Dec 14, 2010 11:37 am 
Offline

Joined: Mon Mar 19, 2007 8:56 am
Posts: 21
Is there a variable inside of the SliderV2 component to track the "button's" position? I want to use this to manipulate the xpos of a Label component

Thanks.


Top
 Profile  
 
PostPosted: Tue Dec 14, 2010 11:55 am 
Offline
User avatar

Joined: Thu Mar 02, 2006 2:12 pm
Posts: 487
Location: Salt Lake City, Utah
There's only the "value" property which you can configure it's range using "min" and "max". You can use the ValueChanged or HandleRelease event to move the label.

Code:
func ValueChanged()
    label_1.xPos = value
endfunc


With some testing you should be able to adjust where it will move the label along side the button.

_________________
Ron L.

http://www.beijerelectronicsinc.com/


Top
 Profile  
 
PostPosted: Tue Dec 14, 2010 12:05 pm 
Offline

Joined: Mon Mar 19, 2007 8:56 am
Posts: 21
Ron L. wrote:
There's only the "value" property which you can configure it's range using "min" and "max". You can use the ValueChanged or HandleRelease event to move the label.

Code:
func ValueChanged()
    label_1.xPos = value
endfunc


With some testing you should be able to adjust where it will move the label along side the button.


This is true, but I want to know the exact pixel. If the slider is 100px wide and the value range is 0-100, then a value of 10 does not equal a position of 10; it's some percentage based on "value".

Is there a private variable or sorts that I could use from an object template?


Top
 Profile  
 
PostPosted: Tue Dec 14, 2010 1:39 pm 
Offline
User avatar

Joined: Thu Mar 02, 2006 2:12 pm
Posts: 487
Location: Salt Lake City, Utah
If you create a template copy of the SliderV2 (Edit->Add/EditTemplates->New Template->"Copy the code of an existing template..") it has a function called "precalc()"; this is called whenever the "value" property is changed. In this function there is some code that calculates the positioning of the button. It saves the location of the button in 4 private variables: left, top, right and bottom. One option would be to change those variables to be public and use them in the "ValueChanged()" event. The code might look something like this:

Code:
func ValueChanged()
    label_1.xPos = xPos + Left
endfunc

_________________
Ron L.

http://www.beijerelectronicsinc.com/


Top
 Profile  
 
PostPosted: Tue Dec 14, 2010 2:02 pm 
Offline

Joined: Mon Mar 19, 2007 8:56 am
Posts: 21
Ron L. wrote:
If you create a template copy of the SliderV2 (Edit->Add/EditTemplates->New Template->"Copy the code of an existing template..") it has a function called "precalc()"; this is called whenever the "value" property is changed. In this function there is some code that calculates the positioning of the button. It saves the location of the button in 4 private variables: left, top, right and bottom. One option would be to change those variables to be public and use them in the "ValueChanged()" event. The code might look something like this:

Code:
func ValueChanged()
    label_1.xPos = xPos + Left
endfunc



That's exactly it. Thanks Ron!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 7 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group