xTaskbar ScrollButtons Thread last updated on 2006-10-06 12:09:36

Posted by member 302889 on 2006-10-05 18:07:58

Hi all,

i'm trying to set up my theme so that it will show a couple of scroll buttons when the xTaskbar module has hit its limit for how many task buttons can be shown so that users can scroll left and right through the task buttons.

i have set the following in my xTaskbar setup...

xTaskbarButtonMaxCount $xTaskbarWidth/40$

so that when the max count of tasks to be shown is reached, there is a space at the end for the 2 scroll buttons.

i need to figure out a way of making sure that when the limit is reached and there are more tasks than xTaskbar can show, the scroll buttons will be shown and when the limit is reduced below the max tasks limit the scroll buttons are hidden.

i would like to use the exported var...

$xTaskbarCurrentButtonCount$

but can't figure out how to make sure that the rest of the code should be written to make it do what i want.

I could get it to check if the $xTaskbarCurrentButtonCount$ value is larger than the xTaskbarButtonMaxCount value but how would i do that? I could use the OnAdd event in xTaskbar but again i can't figure out how to put the three of these things together.

1 OnAdd
2 check if $xTaskbarCurrentButtonCount$ > xTaskbarButtonMaxCount
3 If true show scroll buttons
4 If false, do nothing

and i would also need

1 OnRemove
2 check if $xTaskbarCurrentButtonCount$

Posted by member 302889 on 2006-10-05 18:10:53 link

for some reason, the rest of my post was cut off. It should have finished...

2 check if $xTaskbarCurrentButtonCount$ is less than or equal to xTaskbarButtonMaxCount
3 If true hide scroll buttons
4 If false, do nothing

Can anyone offer me any insight into my predicament??? I'd be interested in any answers.

Thanks for your time...

Cheers

John

Posted by member 248213 on 2006-10-05 20:22:09 link

What are you making your buttons with? xlabel?

Youll need some scripting module for this. There might be some nifty way to do it without mz or lua, but I doubt it.

Maybe this will work:

xTaskbarOnAdd !ScriptedBang
xTaskbarOnRemove !ScriptedBang

Then in lua:

function bang_ScriptedBang ()
if evar.xTaskbarCurrentButtonCount > xTaskbarButtonMaxCount
exec ("!LabelShow Buttons")
else
exec ("!LabelHide buttons")
end

or something...

thats just what you said, but in lua.

Posted by member 302889 on 2006-10-06 11:35:53 link

Yeah, i use xlabel for my buttons but my script module is mzscript-0.9.13, not lua.

i've not used lua before and i have too much in the way of scripts to want to change over to it just now, although i will do when i start my next theme from scratch.

LUA does look really easy to use though. I'm sure it wont be that easy to code in mzscript.

Cheers for your help FD.

john

Posted by member 1885 on 2006-10-06 12:09:36 link

It isn't hard to do the same thing in mzscript, all you need is

*script bang !scrollbuttons
*script gotoif ["%{xtaskbarcurrentbuttoncount}" > "%{xtaskbarbuttonmaxcount}"] showbuttons
*script exec !labelhide scrollbuttons
*script exit
*script label showbuttons
*script exec !labelshow scrollbuttons
*script ~bang


or something like that. That's mzscript 1.0.1 syntax though, couldn't remember what 0.9.13 syntax looked like from the top of my head.

LUA does look really easy to use though.

Um... LUA looks like complete gibberish to me :D