Typo commented on a Page, $treeview  -  Aug 24, 2008

I had to remove
$switchbar
from
$iif($switchbar && %sbpos isnum $replacex(%pos,2,2-3,3,2-3),$gettok(%inin5,32,44),0)
to get it to work for me but after that it seemed fine.

I couldn't see anywhere else in the script that uses the $switchbar identifier or even a %switchbar variable so I just deleted it.

I like this script. Very cool idea but it runs very slow for me tho I'm fairly certain that thats the saveini call.

Also, your code just looks sloopy how you have it. Even if I leave your comments I still make it look a ton better by simply combining some vars and bringing things together like:

alias treeview {
  ;$treeview(size|wsize|hsize|x|y|w|h|pos|position|coord)
  saveini
  var %inin4 $readini($mircini, options, n4), %inin5 $readini($mircini, options, n5), %inin8 $readini($mircini, options, n8)
  ;if you use mirc mIRC 6.32 and above, then you can put the above line inside this statement and
  ;change '$gettok(%inin8,3,44)' to '$treebar'. Therefore its only save the current setting when
  ;the treebar is on. This code have been write to make it work on 6.21 also.
  if ($gettok(%inin8,3,44)) {
    var %pos $gettok(%inin8,2,44), %position $replacex(%pos,0,bottom,1,top,2,left,3,right), %sbpos $gettok(%inin4,21,44), %sbsize $iif(%sbpos isnum $replacex(%pos,2,2-3,3,2-3),$gettok(%inin5,32,44),0), %wsize $calc($window(-2).w - $window(-3).w $iif(%pos isnum 2-3,- %sbsize)), %hsize $gettok(%inin8,23,44), %size = $gettok(%inin8,4,44), %border = $calc(%wsize - %size)
    var %w $iif(%pos isnum 2-3,$int($calc(%wsize - %border $replacex(%pos,2,$null,3,/ 2))),$window(-3).w), %h = $iif(%pos isnum 2-3,$window(-3).h,%hsize), %x $iif(%pos = 3,$calc($window(-2).x + $window(-3).w + %sbsize),$iif(%pos = 2,$int($calc($window(-2).x + (%border / 2))),$window(-3).x)), %y $iif(!%pos,$calc($window(-3).y + $window(-3).h),$iif(%pos = 1,$calc($window(-3).y - %h),$window(-3).y)), %coord %x %y %w %h
  }
  return $($+(%,$1),2)
}

Thats 3 var lines instead of 15 of them.

Well done. 7/10

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.