I need to extend a picture button so that I can control where the text is placed in the button better.
I also want to make the button have a 'hover' image like a web button.
This has proven challenging, but I've made a sample user object below that can be dropped on a window and tested.
Is there a way to effectively control the Z order of controls on a form? I can't see any method except 'send to back' in the IDE.
Also, is there any documentation I can scan for implementing a mousedown event?
[code]
forward
global type uuo_favbut from userobject
end type
type st_legend from statictext within uuo_favbut
end type
type pbackground from picture within uuo_favbut
end type
type pbackgroundhover from picture within uuo_favbut
end type
end forward
global type uuo_favbut from userobject
integer width = 361
integer height = 320
long backcolor = 553648127
string text = "none"
long tabtextcolor = 33554432
long picturemaskcolor = 536870912
st_legend st_legend
pbackground pbackground
pbackgroundhover pbackgroundhover
end type
global uuo_favbut uuo_favbut
forward prototypes
public subroutine of_setbackground (string asfilename)
public subroutine of_sethoverbackground (string asfilename)
public subroutine of_settext (string astext)
public subroutine of_setfontsize (integer aisize)
end prototypes
public subroutine of_setbackground (string asfilename);pBackground.picturename = asfilename
end subroutine
public subroutine of_sethoverbackground (string asfilename);pBackgroundHover.picturename = asfilename
end subroutine
public subroutine of_settext (string astext);st_legend.text = astext
end subroutine
public subroutine of_setfontsize (integer aisize);st_legend.textsize = aiSize
end subroutine
on uuo_favbut.create
this.st_legend=create st_legend
this.pbackground=create pbackground
this.pbackgroundhover=create pbackgroundhover
this.Control[]={this.st_legend,&
this.pbackground,&
this.pbackgroundhover}
end on
on uuo_favbut.destroy
destroy(this.st_legend)
destroy(this.pbackground)
destroy(this.pbackgroundhover)
end on
type st_legend from statictext within uuo_favbut
integer x = 37
integer y = 28
integer width = 288
integer height = 260
boolean bringtotop = true
integer textsize = -10
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Arial"
long textcolor = 33554432
long backcolor = 553648127
string text = "none"
alignment alignment = center!
boolean focusrectangle = false
end type
event clicked;setredraw(false)
pBackground.visible = false
pbackgroundhover.visible = true
st_legend.visible = true
setredraw(true)
sleep (1)
setredraw(false)
pBackground.visible = true
pbackgroundhover.visible = false
st_legend.visible = true
setredraw(true)
Message.StringParm = this.Tag
Parent.PostEvent ("ue_fav_clicked")
end event
type pbackground from picture within uuo_favbut
integer width = 361
integer height = 320
string picturename = "Custom080!"
boolean focusrectangle = false
end type
event clicked;setredraw(false)
pBackground.visible = false
pbackgroundhover.visible = true
st_legend.visible = true
setredraw(true)
sleep (1)
setredraw(false)
pBackground.visible = true
pbackgroundhover.visible = false
st_legend.visible = true
setredraw(true)
Message.StringParm = this.Tag
Parent.PostEvent ("ue_fav_clicked")
end event
type pbackgroundhover from picture within uuo_favbut
boolean visible = false
integer width = 361
integer height = 320
string picturename = "Custom080a!"
boolean focusrectangle = false
end type
[/code]