home *** CD-ROM | disk | FTP | other *** search
/ Minami 40 / MINAMI40.ISO / Extra / winamp3_0-full.exe / Wacs / xml / winamp / scripts / textslidercb.m next >
Text File  |  2002-06-25  |  2KB  |  60 lines

  1. #include <lib/std.mi>
  2.  
  3. Global Slider slidercb;
  4. Global Text textobj;
  5. Global String prefix, one, many;
  6. Global Group pgroup;
  7. Global GuiObject targetbase;
  8.  
  9. System.onScriptLoaded() {
  10.  
  11.   // we only run in groups!
  12.   pgroup = getScriptGroup();
  13.   if (pgroup == NULL) return;
  14.  
  15.   String par = getParam();
  16.  
  17.   String tid = getToken(par, ";", 0);
  18.   String gid = getToken(par, ";", 1);
  19.  
  20.   // if the text object isnt there abort
  21.   textobj = pgroup.findObject(tid);
  22.   if (textobj == NULL) {
  23.     messageBox("textslidercm.maki : text not found (param 0 = " + tid + ")", "Error", 0, "");
  24.     return;
  25.   }
  26.  
  27.   // if the base group isnt there or doesn't have a titlebox.text object, abort
  28.   if (gid != "") {
  29.     targetbase = pgroup.findObject(gid);
  30.     if (targetbase == NULL) {
  31.       messageBox("textslidercm.maki : text not found (param 0 = " + gid + ")", "Error", 0, "");
  32.       return;
  33.     }
  34.   }
  35.  
  36.   String id = getToken(par, ";", 2);
  37.   prefix = getToken(par, ";", 3);
  38.   one = getToken(par, ";", 4);
  39.   many = getToken(par, ";", 5);
  40.   if (many == "") many = one;
  41.  
  42.   if (targetbase != NULL)
  43.     slidercb = targetbase.findObject(id);
  44.   else 
  45.     slidercb = pgroup.findObject(id);
  46.   if (slidercb == NULL) {
  47.     messageBox("titleboxslidercm.make : slidercb not found (param 1 = " + id + ")", "Error", 0, "");
  48.     return;
  49.   }
  50.  
  51.   slidercb.onSetPosition(slidercb.getPosition());
  52.  
  53. }
  54.  
  55. slidercb.onSetPosition(int val) {
  56.   String s = prefix + IntegerToString(val);
  57.   if (val > 1) s = s + many; else s = s + one;
  58.   textobj.setText(s);
  59. }
  60.