Page 1 of 1

how to use the slider and a database?

Posted: Sat Aug 20, 2011 5:43 pm
by jpottsx1
I want to grab the value of a "slider" and put it into a database. I have looked through the docs and find only minimal references to the "Slider" control.

Any help is greatly appreciated

Jeff

Re: how to use the slider and a database?

Posted: Sat Aug 20, 2011 5:48 pm
by Klaus
Hi Jeff,

you are looking for "thumbposition" and "scrollbar" :D
Abbreviations (lazy me): thumbpos and sb

Getting:
...
put the thumbpos of sb "your scrollbar here" into tValueToStore
...

Setting:
...
set the thumbpos of sb "your scrollbar here" into tStoredValue
...

Best

Klaus

Re: how to use the slider and a database?

Posted: Sat Aug 20, 2011 6:00 pm
by bangkok
jpottsx1 wrote:I want to grab the value of a "slider" and put it into a database. I have looked through the docs and find only minimal references to the "Slider" control.
a slider, with the value in a field.

Once you're able to get the value of the slider, then after it's not a problem to write it to a database.

Re: how to use the slider and a database?

Posted: Sat Aug 20, 2011 9:07 pm
by jpottsx1
Thanks for the direction, but I've encountered a new snag.

When I use the following code;
on scrollbardrag
put the thumbpos of sb "mysb" into pTaskName
put "INSERT into tasks (task) VALUES ('" & pTaskName & "')" into tSQL
revExecuteSQL sDatabaseID, tSQL

## Refresh the task list
showTasks
end scrollbardrag
I genererate new entries whenever I drag the mouse over the card, not just when I move the slider. Any ideas on this?

Jeff

Re: how to use the slider and a database?

Posted: Sat Aug 20, 2011 9:58 pm
by bangkok
jpottsx1 wrote: I genererate new entries whenever I drag the mouse over the card, not just when I move the slider. Any ideas on this?
Very strange !

You put this script into the scrollbar "mysb", right ? Or in the card ? I guess you might have another scrollbar on the card ?

What about sDatabaseID, you put a "global sDatabaseID" within the script ?

Re: how to use the slider and a database?

Posted: Sat Aug 20, 2011 10:59 pm
by jpottsx1
I had the script on the card and it was causing the problem.

I fixed the problem with putting the following code;
on mouseup
put the thumbpos of sb "mysb" into pTaskName
end mouseup

for the slider, then I put the following code in the button to create a record;
on mouseUp
put "INSERT into tasks (task) VALUES ('" & pTaskName & "')" into tSQL
revExecuteSQL sDatabaseID, tSQL

## Refresh the task list
showTasks
end mouseUp

All works fine now, thanks for the help.