Progresbar |
Author: |
Message: |
Drakal
Junior Member
Ohh no! im in the warp hole!!
Posts: 32
– / /
Joined: Jun 2007
|
O.P. Progresbar
How do i do a progress bar? i have added a download feature on my skript but i cant see how much that is downloaded or how long time it is to its finished.
Scripts in progres:
AIOS??% 3050 lines (1800 lines more in the xml files) and 6 Mb (total)
(renamed from bad word filter.. it can do more than filter words now ):
Programs in progres:
a calculator (name: Mini): ??% 3600 lines and 280 Kb (it was 100 lines first but my friend wanted it a little bit more advanced)
--------------
Sorry for my english.. im not so good
|
|
09-15-2007 05:10 PM |
|
|
Matti
Elite Member
Script Developer and Helper
Posts: 1646 Reputation: 39
32 / /
Joined: Apr 2004
|
RE: Progresbar
Here are some progress bar functions:
code: function Progress_GetPos(PlusWnd, CtrlId) {
return PlusWnd.SendControlMessage(CtrlId, /*PBM_GETPOS*/ 0x408, 0, 0);
}
function Progress_SetPos(PlusWnd, CtrlId, nNewPos) {
return PlusWnd.SendControlMessage(CtrlId, /*PBM_SETPOS*/ 0x402, nNewPos, 0);
}
function Progress_SetStep(PlusWnd, CtrlId, nStepInc) {
return PlusWnd.SendControlMessage(CtrlId, /*PBM_SETSTEP*/ 0x404, nStepInc, 0);
}
function Progress_StepIt(PlusWnd, CtrlId) {
return PlusWnd.SendControlMessage(CtrlId, /*PBM_STEPIT*/ 0x405, 0, 0);
}
//Usage example
var nPos = Progress_GetPos(oPlusWnd, "PrgDownload");
Progress_SetPos(oPlusWnd, "PrgDownload", nPos+10);
However, the actual position is hard to find. In fact, you should use a timer which gets the current file size of the downloaded file, divides that by the total file size to be downloaded and multiplies that by 100 to get the percentage. The catch is that you can't easily get the total file size, you'd need a text file on the server containing the file size to actually know how big the file to be downloaded is.
Actually, I don't really know if this is true, so if anyone can proof me wrong and provide me a way to get the file size of the server file, please tell me!
|
|
09-15-2007 05:41 PM |
|
|
Drakal
Junior Member
Ohh no! im in the warp hole!!
Posts: 32
– / /
Joined: Jun 2007
|
O.P. RE: Progresbar
didnt undersand anyting of the first do i need a xml file or anything?
Scripts in progres:
AIOS??% 3050 lines (1800 lines more in the xml files) and 6 Mb (total)
(renamed from bad word filter.. it can do more than filter words now ):
Programs in progres:
a calculator (name: Mini): ??% 3600 lines and 280 Kb (it was 100 lines first but my friend wanted it a little bit more advanced)
--------------
Sorry for my english.. im not so good
|
|
09-15-2007 06:00 PM |
|
|
Flash
Junior Member
All time Ready
Posts: 86 Reputation: 2
44 / /
Joined: Aug 2006
|
RE: Progresbar
Interface Windows Schema Documentation
complexType ProgressControl diagram
|
|
09-15-2007 11:28 PM |
|
|
Matti
Elite Member
Script Developer and Helper
Posts: 1646 Reputation: 39
32 / /
Joined: Apr 2004
|
RE: Progresbar
Sorry, I understood your question as how to interact with an existing ProgressControl.
You'll first need to add this in your window:
code: <Control xsi:type="ProgressControl" Id="PrgDownload">
<Postion Left="10" Top="10" Width="150" Height="25"/>
</Control>
Then, whenever you need to get or change the position, use Progress_GetPos or Progress_SetPos. Alternatively, you could first set the step increment with Progress_SetStep and then use Progress_StepIt to step further.
|
|
09-16-2007 06:37 AM |
|
|
Drakal
Junior Member
Ohh no! im in the warp hole!!
Posts: 32
– / /
Joined: Jun 2007
|
O.P. RE: Progresbar
Thank you Mattike but your control didnt work(fixed it on my self) and i got it to move from 0 to 100% when i download a file but without a timer(used my crazy other ways )... but to fix i timer... the timer i already has dont work any more so can you give me a basic lesson in timers?(feel like a nood )
Scripts in progres:
AIOS??% 3050 lines (1800 lines more in the xml files) and 6 Mb (total)
(renamed from bad word filter.. it can do more than filter words now ):
Programs in progres:
a calculator (name: Mini): ??% 3600 lines and 280 Kb (it was 100 lines first but my friend wanted it a little bit more advanced)
--------------
Sorry for my english.. im not so good
|
|
09-16-2007 08:39 AM |
|
|
Matti
Elite Member
Script Developer and Helper
Posts: 1646 Reputation: 39
32 / /
Joined: Apr 2004
|
RE: Progresbar
Well, first you need to create one with
code: MsgPlus.AddTimer("MyTimer", 500);
This will create a timer called MyTimer with an interval of 500 milliseconds.
Then, you need an event:
code: function OnEvent_Timer(sTimerId) {
if(sTimerId == "MyTimer") {
//Do progress bar stuff here
MsgPlus.AddTimer("MyTimer", 500); //Repeat
}
}
This will create a "timed loop", and when you're done with it, you need to stop the timer with MsgPlus.CancelTimer("MyTimer") and make sure that MsgPlus.AddTimer doesn't get called again.
|
|
09-16-2007 10:01 AM |
|
|
Drakal
Junior Member
Ohh no! im in the warp hole!!
Posts: 32
– / /
Joined: Jun 2007
|
O.P. RE: Progresbar
thx.. now i se that my old timer didnt loop but what should "oPlusWnd" be? window worked befor and window was msgplus.createwnd(....) but now in timer it just opens alot of windows until it reaches 100%
Scripts in progres:
AIOS??% 3050 lines (1800 lines more in the xml files) and 6 Mb (total)
(renamed from bad word filter.. it can do more than filter words now ):
Programs in progres:
a calculator (name: Mini): ??% 3600 lines and 280 Kb (it was 100 lines first but my friend wanted it a little bit more advanced)
--------------
Sorry for my english.. im not so good
|
|
09-16-2007 12:02 PM |
|
|
Matti
Elite Member
Script Developer and Helper
Posts: 1646 Reputation: 39
32 / /
Joined: Apr 2004
|
RE: Progresbar
quote: Originally posted by Drakal
thx.. now i se that my old timer didnt loop but what should "oPlusWnd" be? window worked befor and window was msgplus.createwnd(....) but now in timer it just opens alot of windows until it reaches 100%
You'll need to create a global variable and set that to the created window, and when it's destroyed you clear the variable again. When you declare it as global, you can use it wherever you like. I think you'll understand it better with the following style example:
code: var MainWnd = false;
function OpenThingy() {
MainWnd = MsgPlus.CreateWnd("XML", "WINDOWID");
//Other stuff, like the timer
Progress_SetStep(MainWnd.Handle, "PROGRESS", 10);
MsgPlus.AddTimer("MyTimer", 500);
}
function OnEvent_Timer(sTimerId) {
if(sTimerId == "MyTimer" && MainWnd != false) {
//Do timer stuff
Progress_StepIt(MainWnd.Handle, "PROGRESS");
//Re-create timer
MsgPlus.AddTimer("MyTimer", 500);
}
}
function OnWINDOWIDEvent_Destroyed(PlusWnd) {
MsgPlus.CancelTimer("MyTimer"); //Cancel timer
MainWnd = false; //Clear global variable
}
|
|
09-16-2007 05:25 PM |
|
|
Drakal
Junior Member
Ohh no! im in the warp hole!!
Posts: 32
– / /
Joined: Jun 2007
|
O.P. RE: Progresbar
code: function Progress_SetStep(PlusWnd, CtrlId, nStepInc) {
return PlusWnd.SendControlMessage(CtrlId, /*PBM_SETSTEP*/ 0x404, nStepInc, 0);
}
it is some thing wrong in this code. debug says something about objects on the line "return PlusWnd.SendCont...."
Scripts in progres:
AIOS??% 3050 lines (1800 lines more in the xml files) and 6 Mb (total)
(renamed from bad word filter.. it can do more than filter words now ):
Programs in progres:
a calculator (name: Mini): ??% 3600 lines and 280 Kb (it was 100 lines first but my friend wanted it a little bit more advanced)
--------------
Sorry for my english.. im not so good
|
|
09-17-2007 01:43 PM |
|
|
Pages: (2):
« First
[ 1 ]
2
»
Last »
|
|