Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Code Gallery (https://forums.graalonline.com/forums/forumdisplay.php?f=179)
-   -   A Simple Download Dialog (https://forums.graalonline.com/forums/showthread.php?t=73412)

middo 04-10-2007 06:57 PM

A Simple Download Dialog
 
Something I whipped up real quickly. It works.

It sits discretely in the bottom left corner. Takes up little space.

PHP Code:

//#CLIENTSIDE

function onCreated()
{
  new 
GuiBitmapBorderCtrl("progressWin") {
    
useownprofile true;
    
profile.bitmap "defalutborder.png"/* I have a own profile here since my server uses it's own images for the GUIS. I made it the default for here*/
    
profile.transparency=.8;
    
width 160;
    
height 100;
    
canmove=false;
    
canresize=false;
    
visible false;
    
10;
    
screenheight-height-40;
    
thiso.textFields={"filename","progress"};
    
thiso.textPos={20,45};

    new 
GuiProgressCtrl("fileProgress") {
      
profile GuiBlueProgressProfile;
      
10;
      
45;
      
width 140;
      
height 24;
      
progress 0;
      
layer=5;
    }    
    
    for (
;thiso.textFields.size();i++) //generate
    
{
      new 
GuiTextCtrl("text_"@thiso.textFields[i]) {
        
useownprofile=true;
        
profile.fontcolor={0,0,0};
        
profile.fontcolorhl={0,0,0};        
        
profile.fontsize=16;
        
profile.align="center";
        
profile.justify="center";
        
justify "center";
        
align "center";

        
width140;
        
height=20;
        
x=5;        
        
y=thiso.textPos[i];
        
text thiso.textFields[i];
        
layer=6;
      }
    }
  } 
}

function 
onTimeout()
{
  if (
downloadsize 1600
  {
    
progressWin.show();
    
text_filename.text   downloadfile;
    
text_progress.text   int((downloadpos/downloadsize)*100)@"%";
    
text_progress.bringtofront();
    
fileProgress.progress=(downloadpos/downloadsize); 
  } else {
  
progressWin.hide();
  }
}

setTimer(.05); 


Rapidwolve 04-10-2007 09:20 PM

Simple and neat, good job. :)

cbk1994 04-11-2007 01:16 AM

Very nice, but what's the point of this rather than a GUPD? Or would this show anything downloaded?

Rapidwolve 04-11-2007 02:43 AM

This will popup for anything that is currently being downloaded I believe

DustyPorViva 04-11-2007 02:47 AM

I don't think you need a check for the filesize... I tried out the download variables and they won't even set for small files.

Rapidwolve 04-11-2007 02:54 AM

It only shows up for large files like when you press [F2] and it says 'Downloading Big File'

middo 04-11-2007 05:09 AM

Things above 1600 are shown I believe.


All times are GMT +2. The time now is 09:19 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.