mIRC Homepage
Posted By: mIRCd Scrollbar problems - 04/02/03 10:44 PM
I have made a small dialog thing which adjusts the volume using 2 scrollbars controlling the mp3 volume and the main volume.
The scrollbars have max and min values of 10 - 0

When position 0 is selected the volume goes to max and then sets %vol1 as 10 , position 10 sets the volume as min and %vol1 as 0...

What i want to happen is that as the %variable is set and remembered, the next time the dialog is opened for the scrollbar to be at the relevant position between the max and min values eg..
on *:dialog:vol:init:*: {
if (%vol1 == 10) { }
}

but the problem and question is... how can i move the scroll bar as the dialog initiates...?

thanks.
Posted By: qwerty Re: Scrollbar problems - 04/02/03 10:50 PM
mIRC 5.9 versions.txt:

82.Added scrollbar control support to custom dialogs:

scroll "text", id, x y w h, style (top left bottom right
horizontal range N)

on 1:dialog:name:scroll:id:etc.

The /did -c switch can be used to set the scroll position,
you can use $did().sel to find current position.
Posted By: Hammer Re: Scrollbar problems - 05/02/03 09:43 PM
There is no reason to save the value, just get the current value and use that. Here is an excerpt from my own script to show you how to do this (showing just the relevant bits from the script):
Code:
  ;  from the table definition
  ;
  text "Master Volume", 1044, 8 35 42 6
  scroll "", 1045, 0 43 270 9, range 65535 horizontal bottom
  text "*.mp3, *.wav", 1046, 9 55 42 6
  scroll "", 1047, 0 63 270 9, range 65535 horizontal bottom
  text "*.mid", 1048, 9 75 42 6
  scroll "", 1049, 0 83 270 9, range 65535 horizontal bottom
  check "Mute", 1050, 240 35 21 6, left
  check "Mute", 1051, 240 55 21 6, left
  check "Mute", 1052, 240 75 21 6, left
  ;
  ;  and later, the events that "run" the scrollbars
 
on *:DIALOG:dMP3Player:init:*:{
  did -c $dname 1045 $vol(master)
  did -c $dname 1047 $vol(wave)
  did -c $dname 1049 $vol(midi)
}
  
on *:DIALOG:dMP3Player:scroll:101:{
  if ($timer(MoveDMP3Player)) .timerMoveDMP3Player off
  did -ra dMP3Player 105 $gmt($did(dMP3Player,101).sel,n:ss)
  .timerMP3Player -m 1 500 AdjustPosition
}
 
;  Volume sliders
;  Master Volume - MP3/Wave - MIDI
on *:DIALOG:dMP3Player:scroll:1045: .vol -v $did($did).sel
on *:DIALOG:dMP3Player:scroll:1047: .vol -w $did($did).sel
on *:DIALOG:dMP3Player:scroll:1049: .vol -m $did($did).sel
 
;  Mute checkboxes
;  Master Volume - MP3/Wave - MIDI
on *:DIALOG:dMP3Player:sclick:1050: .vol $+(-vu,$iif($did($did).state,1,2))
on *:DIALOG:dMP3Player:sclick:1051: .vol $+(-wu,$iif($did($did).state,1,2))
on *:DIALOG:dMP3Player:sclick:1052: .vol $+(-mu,$iif($did($did).state,1,2))
 
alias MoveDMP3Player {
  if ($insong) && ($dialog(dMP3Player)) {
 
    ;  Check the current positions for the sliders/checkboxes, in case they
    ;  are altered by other processes (keyboard volume control/Windows 
    ;  volume control).
 
    did -z dMP3Player 101 0 $int($calc($insong.length / 1000))
    did -c dMP3Player 1045 $vol(master)
    did -c dMP3Player 1047 $vol(wave)
    did -c dMP3Player 1049 $vol(midi)
    did $iif($vol(master).mute,-c,-u) dMP3Player 1050
    did $iif($vol(wave).mute,-c,-u) dMP3Player 1051
    did $iif($vol(midi).mute,-c,-u) dMP3Player 1052
    did -c  dMP3Player 101 $int($calc($insong.pos / 1000))
  }
}

You can adapt the principles shown here to use in your own script. cool
© mIRC Discussion Forums