Gamestudio Links
Zorro Links
Newest Posts
Trading Journey
by 7th_zorro. 04/27/24 04:42
Help with plotting multiple ZigZag
by M_D. 04/26/24 20:03
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
M1 Oversampling
by jcl. 04/26/24 11:12
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
Eigenwerbung
by jcl. 04/26/24 11:08
MT5 bridge not working on MT5 v. 5 build 4160
by EternallyCurious. 04/25/24 20:49
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (Akow, 7th_zorro, VoroneTZ, PeroPero), 812 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
wandaluciaia, Mega_Rod, EternallyCurious, howardR, 11honza11
19049 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 2 1 2
Re: hslider max value? [Re: Ruben] #447558
12/20/14 07:18
12/20/14 07:18
Joined: Jun 2010
Posts: 590
California
Ruben Offline OP
User
Ruben  Offline 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:

Code:
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 Offline OP
User
Ruben  Offline OP
User

Joined: Jun 2010
Posts: 590
California
Originally Posted By: txesmi
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:

Code:
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.
Re: hslider max value? [Re: Ruben] #447773
01/04/15 13:51
01/04/15 13:51
Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
txesmi Offline
Serious User
txesmi  Offline
Serious User

Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
happy to help!

Page 2 of 2 1 2

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1