Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

source code for progress meter needed

Status
Not open for further replies.

larryh77

Programmer
Oct 9, 2006
3
US
We are using PowerBuilder 9. Does anybody have a progress meter object I can have, or the source code for it?
 
If you are using the PFC, there is a progressbar in there that you can use.
 
Hi,

here is one you can take as template and build your own from it.

-------------------------------------------------------

$PBExportHeader$uo_progress_prozent.sru
forward
global type uo_progress_prozent from userobject
end type
type st_2 from statictext within uo_progress_prozent
end type
type st_prozent from statictext within uo_progress_prozent
end type
type st_1 from statictext within uo_progress_prozent
end type
type p_1 from picture within uo_progress_prozent
end type
end forward

global type uo_progress_prozent from userobject
integer width = 2130
integer height = 160
boolean border = true
long backcolor = 12632256
long tabtextcolor = 33554432
long picturemaskcolor = 536870912
st_2 st_2
st_prozent st_prozent
st_1 st_1
p_1 p_1
end type
global uo_progress_prozent uo_progress_prozent

type variables
decimal{8} idec_total_steps = 1
decimal{8} idec_akt_step = 0
end variables

forward prototypes
public subroutine of_set_steps (integer ai_steps)
public subroutine of_next_step ()
public subroutine of_set_all_steps ()
end prototypes

public subroutine of_set_steps (integer ai_steps);idec_total_steps = ai_steps
idec_akt_step = 0
st_prozent.text = "0 %"

end subroutine

public subroutine of_next_step ();decimal{0} ldc_proz

IF idec_akt_step < idec_total_steps THEN
idec_akt_step ++
p_1.width = this.width * ( idec_akt_step / idec_total_steps)
ldc_proz = idec_akt_step / idec_total_steps * 100.0
st_prozent.text = string(ldc_proz) + " %"
ELSE
p_1.width = this.width
st_prozent.text = "100 %"
END IF
end subroutine
public subroutine of_set_all_steps ();
idec_akt_step = idec_total_steps
p_1.width = this.width
st_prozent.text = "100 %"

end subroutine
on uo_progress_prozent.create
this.st_2=create st_2
this.st_prozent=create st_prozent
this.st_1=create st_1
this.p_1=create p_1
this.Control[]={this.st_2,&
this.st_prozent,&
this.st_1,&
this.p_1}
end on

on uo_progress_prozent.destroy
destroy(this.st_2)
destroy(this.st_prozent)
destroy(this.st_1)
destroy(this.p_1)
end on

event constructor;p_1.width = 0
end event

type st_2 from statictext within uo_progress_prozent
integer x = 517
integer width = 411
integer height = 76
integer textsize = -10
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Arial"
long backcolor = 12632256
boolean enabled = false
string text = "abgeschlossen"
alignment alignment = right!
boolean focusrectangle = false
end type

type st_prozent from statictext within uo_progress_prozent
integer x = 325
integer width = 183
integer height = 76
integer textsize = -10
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Arial"
long backcolor = 12632256
boolean enabled = false
string text = "0 %"
alignment alignment = right!
boolean focusrectangle = false
end type

type st_1 from statictext within uo_progress_prozent
integer width = 315
integer height = 76
integer textsize = -10
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Arial"
long backcolor = 12632256
boolean enabled = false
string text = "Vorgang zu"
boolean focusrectangle = false
end type

type p_1 from picture within uo_progress_prozent
integer y = 80
integer width = 2121
integer height = 72
string picturename = "media\process.bmp"
boolean focusrectangle = false
end type

---------------------------------------------------------

I have choosen a picture for the meter because it is more fancy than a simple rectangle. but it works with all resizable objects.

have fun

Bernd
 
Hi,

just import it into a library of your choice.

it should work

the code is from pb8 but nothing in there that have changed in major versions

btw. how can a file (eg. progressmeter.pbl) be uploaded here?
 
thanks was just wondering what the format was but now i now it just an export. cheers.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top