2 registered members (AndrewAMD, 7th_zorro),
1,285
guests, and 4
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: hslider max value?
[Re: Ruben]
#447558
12/20/14 07:18
12/20/14 07:18
|
Joined: Jun 2010
Posts: 590 California
Ruben
OP
User
|
OP
User
Joined: Jun 2010
Posts: 590
California
|
Tsexmi: I tried your solution. It does set transf_amt as the max value on the hslider. However, it does not allot equal increments for the max value on the slider bar. For example, when I set my hslider as such:
hslider(450, 514, 150, "horizontalSlider.pcx", 0, 1, transf_amt);
...the amount on the hslider will start off at the transf_amt toward the far right of the horizontal slider (example: transf_amt = 4 ). However, when I move the slider button to the left, it immediately places the transf_amt value in the range of 0 - 1, and it does not go any higher than 1. I am really trying to make the horizontal slider dynamic in that transf_amt needs to be the max value any time this horizontal slider is accessed, and if I move the horizontal button to the left, it should increment one less than what transf_amt equals, and keep incrementing one less as I keep moving the horizontal button to the left, all the way down to 0 , in equal increments. Any idea on what I am doing wrong?
Last edited by Ruben; 12/20/14 07:20.
|
|
|
Re: hslider max value?
[Re: txesmi]
#447694
12/29/14 06:38
12/29/14 06:38
|
Joined: Jun 2010
Posts: 590 California
Ruben
OP
User
|
OP
User
Joined: Jun 2010
Posts: 590
California
|
Hi Ruben, it is not possible to use variables as limits on sliders. You can define the limits of the slider with the content of a variable but no with the variable itself as you tried. You get that error when trying to define a limit with the content of a non initialized variable. You only need to modify the slider just before showing the panel. 'pan_setslider' works a bit different, parallel to 'slider' instead of 'hslider'. Here is an example:
var transf_amt = 0;
BMAP *bmpTransferOn = "transfer_button_click.pcx";
BMAP *bmpTransferOff = "transfer_button.pcx";
BMAP *bmpTransferOver = "transfer_button_hover.pcx";
BMAP *bmpTransferSliderBg = "horizontalSliderBg.pcx";
BMAP *bmpTransferSliderKnob = "horizontalSlider.pcx";
function buttonTransferItems ( var button_id, PANEL *panel )
{
reset ( panel, SHOW );
printf ( "%.0f", (double)transf_amt );
}
PANEL* invTransferAmount =
{
digits ( 590, 490, 5, *, 1, transf_amt );
button ( 640, 510, bmpTransferOn, bmpTransferOff, bmpTransferOver, buttonTransferItems, NULL, NULL );
slider ( 450, 514, bmpTransferSliderBg, bmpTransferSliderKnob, 0, 1, transf_amt );
flags = OUTLINE;
}
...
transf_amt = 0;
var count_max = 1 + floor ( random(10) ); // maximum of items
pan_setslider ( invTransferAmount, 1, 450, 514, bmpTransferSliderBg, bmpTransferSliderKnob, 0, count_max, transf_amt );
set ( invTransferAmount, SHOW );
...
Salud! Thank you Txesmi! Due to your advice, I finally got the slider max value to work. Thanks again! :-)
Last edited by Ruben; 12/29/14 06:38.
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|