Page 1 of 1

Trackbar problem

Posted: Sun Dec 14, 2008 10:27 pm
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]

Posted: Mon Dec 15, 2008 12:28 am
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!

Posted: Mon Dec 15, 2008 12:52 am
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.