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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

"Pretty" buttons 1

Status
Not open for further replies.

thekl0wn

Programmer
Jan 12, 2006
292
US
I've opted to take on a new project that will require some different tactics then I think PB was designed for. My main issue is that I need/want "pretty"/custom buttons.

The only real option I've came up with is to use picture controls which load the image to display in a load event, and utilize the Clicked! event to trigger things, just as a button would. I would probably inherit one from the base that way I could add any special functionality later.

Any other thoughts/options?
 
you might have a look at this

it is a framework for Powerbuilder that might satisfy your needs or you might built a custum visual object as a button-ancaster for others. this ancaster my include all other object types (pictures, text, lines, ovals... even datawindows and activex(ole) or animated gifs etc). all objects need to wrap the clicked event to a parent costumvisual userevent. eg "ue_clicked". this event "ue_clicked" need not to be assigned with any pbm_... event_id and MUST not be assinged with pbm..cklicked.. event_id. the clicked event of the parent object needs also be wrapped to "ue_clicked". than all clicked events (on any object) is handled in "ue_ckicked".

here is a small example (exported object from library - maybe imported to any library/app for testing)

*****************************************
$PBExportHeader$master_button.sru
forward
global type master_button from userobject
end type
type p_1 from picture within master_button
end type
type st_1 from statictext within master_button
end type
end forward

global type master_button from userobject
integer width = 1093
integer height = 88
boolean border = true
long backcolor = 12632256
string text = "none"
borderstyle borderstyle = styleraised!
long tabtextcolor = 33554432
long picturemaskcolor = 536870912
event ue_clicked ( )
event clicked pbm_lbuttonclk
p_1 p_1
st_1 st_1
end type
global master_button master_button

type variables

end variables
forward prototypes
public subroutine of_set_picture (string as_picname)
public subroutine of_set_text (string as_text)
end prototypes

event clicked;triggerevent( "ue_clicked")
end event

public subroutine of_set_picture (string as_picname);p_1.picturename = as_picname
end subroutine

public subroutine of_set_text (string as_text);st_1.text = as_text
end subroutine

event constructor;// do here reformatting of all objects if needed for objectalignment
end event

on master_button.create
this.p_1=create p_1
this.st_1=create st_1
this.Control[]={this.p_1,&
this.st_1}
end on

on master_button.destroy
destroy(this.p_1)
destroy(this.st_1)
end on

type p_1 from picture within master_button
integer width = 146
integer height = 84
boolean originalsize = true
string picturename = "btn_leer_green.bmp"
boolean focusrectangle = false
end type

event clicked;parent.triggerevent( "ue_clicked")
end event

type st_1 from statictext within master_button
integer x = 187
integer y = 4
integer width = 846
integer height = 80
integer textsize = -10
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "MS Sans Serif"
long backcolor = 12632256
string text = "none"
boolean focusrectangle = false
end type

event clicked;parent.triggerevent( "ue_clicked")
end event
*************************************************
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top