Trackbar problem

Just starting out? Need help? Post your questions and find answers here.
wh1sp3r
User
User
Posts: 11
Joined: Mon Apr 17, 2006 9:08 pm

Trackbar problem

Post by wh1sp3r »

I am using trackbar for scaling graph. I have trackbar for X axe and for Y axe. I have checkbox here for ratio.



Code: Select all

hodnotax = GetGadgetState(#trackbar_0)     
hodnotay = GetGadgetState(#trackbar_1)

If hodnotax <> zvetsenix
zvetsenix = hodnotax
If pomer = 1
SetGadgetState(#trackbar_1, hodnotay)
EndIf
Aktualizuj_graf()
EndIf   
If hodnotay <> zvetseniy
zvetseniy = hodnotay
If pomer = 1
SetGadgetState(#trackbar_0, hodnotax)
EndIf
Aktualizuj_graf()
EndIf  [quote]

So, when I change value at trackbar 1, It should change trackbar 2 automaticly. Of course, it doesnt work, only with constants.[/quote]
User avatar
Rook Zimbabwe
Addict
Addict
Posts: 4322
Joined: Tue Jan 02, 2007 8:16 pm
Location: Cypress TX
Contact:

Post by Rook Zimbabwe »

Clue:
hodnotax = GetGadgetState(#trackbar_0)
AND
SetGadgetState(#trackbar_0, hodnotax)
:D

It looks like you are trying to set it as what it already is!

Code: Select all

hodnotax = GetGadgetState(#trackbar_0)
hodnotay = GetGadgetState(#trackbar_1)

If hodnotay <> zvetseniy
    hodnotay = zvetseniy
    If pomer = 1
        SetGadgetState(#trackbar_1, hodnotay)
        ; Yet you already called "hodnotay" as whatever Trackbar_1 is already at!
    EndIf
    Aktualizuj_graf()
EndIf
If hodnotax <> zvetsenix
    hodnotax = zvetsenix
    If pomer = 1
        SetGadgetState(#trackbar_0, hodnotax)
    EndIf
    Aktualizuj_graf()
EndIf  
Without understanding your variable names OR if you have this in a procedure (in which case you should either get the numbers from INDISE the procedure or call them as GLOBAL... I can't help more!

Sorry!
Binarily speaking... it takes 10 to Tango!!!

Image
http://www.bluemesapc.com/
Sparkie
PureBatMan Forever
PureBatMan Forever
Posts: 2307
Joined: Tue Feb 10, 2004 3:07 am
Location: Ohio, USA

Post by Sparkie »

Your code, at the very least, is missing the following:

2 Constant values (#trackbar_0 and #trackbar_1)
1 OpenWindow
2 TrackBarGadgets
1 CheckBoxGadget
1 Aktualizuj_graf Procedure
1 Event Loop

Add those and try again.
What goes around comes around.

PB 5.21 LTS (x86) - Windows 8.1
Post Reply