Home » U++ Library support » U++ Widgets - General questions or Mixed problems » Creating a hyperlink label
Re: Creating a hyperlink label [message #43755 is a reply to message #41235] |
Fri, 03 October 2014 09:31 |
|
koldo
Messages: 3361 Registered: August 2008
|
Senior Veteran |
|
|
Hello all
If you do not mind I would like to include it in Controls4U.
.cpp/.h
class HyperlinkText : public ParentCtrl {
public:
HyperlinkText() {
label.SetInk(LtBlue());
*this << label.SizePos();
}
HyperlinkText& SetText(const char* txt) {
label.SetText(txt);
return *this;
}
HyperlinkText& SetHyperlink(const char* str) {
hyperlink = str;
return *this;
}
private:
StaticText label;
String hyperlink;
virtual Image CursorImage(Point p, dword keyflags) {
return Image::Hand();
}
virtual void LeftDown(Point p, dword keyflags) {
LaunchWebBrowser(hyperlink);
}
};
.usc
ctrl HyperlinkText {
group "Static";
GetMinSize() { return XMinSize(); }
GetStdSize() { sz = XMinSize(); sz.cy += 6; sz.cx *= 5; return sz; }
Doc SetText ? "Label of control" ;
Doc SetHyperlink ? "Hyperlink" ;
Align SetAlign = ALIGN_LEFT;
Font SetFont = StdFont();
Frame SetFrame @1;
ViewRect(w) {
r = GetRect();
DrawCtrlFrame(w, r, .SetFrame);
return r;
}
ViewSize(w) {
r = ViewRect(w);
return Size(r.right - r.left, r.bottom - r.top);
}
Paint(w) {
sz = ViewSize(w);
textsize = GetTextSize(.SetText, .SetFont);
px = 0;
if(.SetAlign == "ALIGN_CENTER")
px = (sz.cx - textsize.cx) / 2;
if(.SetAlign == "ALIGN_RIGHT")
px = sz.cx - textsize.cx;
w.DrawText(px, (sz.cy - textsize.cy) / 2, .SetText, .SetFont, :SLtBlue);
}
Sample() {
.SetText = "Text";
.SetFont = Arial(10).Bold().Italic();
}
};
Best regards
IƱaki
|
|
|
|
|
Creating a hyperlink label
By: crydev on Fri, 15 November 2013 08:52
|
|
|
Re: Creating a hyperlink label
By: Klugier on Fri, 15 November 2013 15:43
|
|
|
Re: Creating a hyperlink label
By: crydev on Fri, 15 November 2013 17:33
|
|
|
Re: Creating a hyperlink label
By: Klugier on Fri, 15 November 2013 20:20
|
|
|
Re: Creating a hyperlink label
By: crydev on Sun, 17 November 2013 12:05
|
|
|
Re: Creating a hyperlink label
By: Klugier on Sun, 17 November 2013 12:35
|
|
|
Re: Creating a hyperlink label
By: crydev on Sun, 17 November 2013 17:27
|
|
|
Re: Creating a hyperlink label
By: koldo on Fri, 03 October 2014 09:31
|
|
|
Re: Creating a hyperlink label
By: mirek on Mon, 13 October 2014 12:00
|
|
|
Re: Creating a hyperlink label
By: koldo on Tue, 14 October 2014 09:57
|
|
|
Re: Creating a hyperlink label
By: Edward on Sun, 01 March 2015 02:31
|
|
|
Re: Creating a hyperlink label
By: mirek on Sun, 01 March 2015 08:12
|
Goto Forum:
Current Time: Tue May 14 15:25:14 CEST 2024
Total time taken to generate the page: 0.01492 seconds
|