View Full Version : Extract Progressbar out of MessageBox
msascha
13 Apr 2007, 3:41 AM
Hi,
I really like the simplicity of the progressbar in the MessageBox widget. Is there any way this can be factored out of there into a standalone widget?
Sascha
jack.slocum
13 Apr 2007, 3:45 AM
With the message, or just the bar?
msascha
13 Apr 2007, 3:49 AM
The bar with an optional message would be great.
PS: That was fast! Don't you ever sleep? :)
jack.slocum
13 Apr 2007, 3:54 AM
PS: That was fast! Don't you ever sleep?
Not with a release in 2 days - I need to though it's almost 8am!
I will look at tomorrow (today?) when my brain is functioning again. If it's simple I can pull it out otherwise I will add it to the 1.1 list. Is that reasonable?
msascha
13 Apr 2007, 3:59 AM
Perfect! Thanks...
msascha
1 Jun 2007, 3:26 AM
Hi,
any news on this? I didn't saw it in the offical feature request list.
Sascha
brian.moeskau
5 Jun 2007, 8:54 AM
This will not be in 1.1, but it is currently on the list for 2.0 barring some unforeseen issue.
dnixon
7 Jun 2007, 2:04 PM
I have a simple cell renderer that displays a cell value as a progress bar in a grid cell.
As implemented it assumes a numeric value in the range 0-100 but that can easily be scaled if you like. It's just a <div> + css so can be used standalone easily. I have only tested in FF2.0 and IE6. First image shows how it looks. Second image is the red bar image file it uses.
http://img365.imageshack.us/img365/5189/progress2kp2.gif
http://img470.imageshack.us/img470/8776/redbarep9.gif
style:
.progress {
width: 100%;
height: 100%;
background-image: url("images/redbar.gif");
background-repeat: no-repeat;
text-color: #000000;
background-color: #B3D3EE;
border-width: 1px;
border-style: solid;
border-color: #336699;
}
column model:
cm = new Ext.grid.ColumnModel([
.
.
{header: "% Complete", width: 100, renderer: progress, dataIndex: 'percent_done'},
.
.
]);
custom renderer:
// custom renderer for status % complete
function progress(val){
if(val < 0) {
val = 0;
} else if(val > 100) {
val = 100;
}
if(val > 49){
return '<div class="progress" style="background-position: '+val+'% 10%; ">' + val + '</div>';
}else {
return '<div class="progress" style="background-position: '+val+'% 0%; text-indent: 90%;">' + val + '</div>';
}
return val;
}
I can understand what you are doing, but I don't understand why you would load an image which has only one color (red)? I would implement this kind of functionality with a positioned div that is 2 pixel wide with background-color:#f00 instead. :-/
dnixon
12 Jun 2007, 10:31 AM
Well the way I did it the whole progress bar is one <div> rather than having a div for the background and number and another for the indicator bar (red). Using both a background color and an offset background image within a single <div> seems simpler and more object oriented to me.
Dave
stever
12 Jun 2007, 4:05 PM
How about finding it in BasicDialog?
dnixon
12 Jun 2007, 4:56 PM
SMOP to stick it in a grid cell.
brian.moeskau
12 Jun 2007, 10:14 PM
I guess I'm not one of the cool kids. SMOP?
rtannert2
13 Jun 2007, 3:10 AM
I guess I'm not one of the cool kids. SMOP?
I'm not either, but apparently Google is: "small matter of programming"
Hemlock
24 Jun 2008, 1:04 PM
Now that the ProgressBar has been extracted can MessageBox be reworked so ProgressBar isn't a requirement? We're trying to get our file sizes down...
brian.moeskau
24 Jun 2008, 6:13 PM
No plans for it. If you look at ProgressBar there's not much code at all, and its class hierarchy is extremely shallow (it extends BoxComponent). It would be a lot of effort for trivial byte savings.
Powered by vBulletin® Version 4.1.5 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.