Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » LineEdit, EditFields, DocEdit » Layout macro fixes
Layout macro fixes [message #11030] Wed, 15 August 2007 18:36
mrjt is currently offline  mrjt
Messages: 705
Registered: March 2007
Location: London
Contributor
Not sure if this has already been fixed as I'm still using 707-dev3. EditField and DocEdit had SetFont and SetFrame in the wrong order and would fail if both were used. LineEdit was inheriting from EditField when it should have been DocEdit. I've also added additional proterties.

ctrl EditField {
	group "Input fields";

	GetMinSize() { sz = GetTextSize("X"); sz.cy += 6; return sz; }
	GetStdSize() { sz = GetMinSize(); sz.cx *= 8; return sz; }

	Frame SetFrame = InsetFrame() @1;
	Font  SetFont = StdFont();
	bool  SetEditable = true @1 ? "Editable";
	bool  WantFocus = true;
	int   MaxChars;
	bool  AlignRight;
	Text  Tip;
//	Qtf   SetInfo @1 ? "Info of control" ;

	Paint(w) {
		r = GetRect();
		DrawCtrlFrame(w, r, .SetFrame);
		w.DrawRect(r, :SWhite);
		PaintData(w);
	}

	PaintText(w, text) {
		w.DrawText(3, (GetSize().cy - GetTextSize(text, Arial(10)).cy) / 2,
			(.SetEditable ? "" : "R/O ") + text, Arial(10), :SMagenta);
	}

	PaintData(w) {
		PaintText(w, "EditField");
	}
}

ctrl DocEdit {
	group "Editors";

	GetMinSize() { sz = GetTextSize("X"); sz.cy += 6; return sz; }
	GetStdSize() { sz = GetMinSize(); sz.cx *= 8; return sz; }

	Frame SetFrame = InsetFrame() @1;
	Font  SetFont = StdFont();
	bool  SetEditable = true @1 ? "Editable";
	bool  WantFocus = true @1;
	Text  Tip @1;
//	Qtf   SetInfo @1 ? "Info of control" ;

	Paint(w) {
		r = GetRect();
		DrawCtrlFrame(w, r, .SetFrame);
		w.DrawRect(r, :SWhite);
		PaintData(w);
	}

	PaintText(w, text) {
		w.DrawText(3, (GetSize().cy - GetTextSize(text, Arial(10)).cy) / 2,
			(.SetEditable ? "" : "R/O ") + text, Arial(10), :SMagenta);
	}

	PaintData(w) {
		PaintText(w, "DocEdit");
	}
}

ctrl LineEdit {
	group "Editors";

	>DocEdit;
	
	Font  SetFont = Courier(16);
	int   TabSize = 4;
	bool  NoHorzScrollbar = false ? "No Horz Scrollbar";
	bool  ShowTabs = true;
	bool  WithCutLine = true;

	PaintData(w) {
		PaintText(w, "LineEdit");
	}
}

I'm not 100% sure how the @ stuff works so apologies if I've got it wrong.

Also, a quick question. In RichText.h we have:
String DeQtf(const char *s);
String DeQtfLf(const char *s);
...
String AsQTF(const RichObject& obj);
RichText ParseQTF(const char *qtf, bool scolors = false, byte accesskey = 0);

Why are the cases (Qtf/QTF) different?

Cheers,
James
Previous Topic: TextCtrl not working
Next Topic: EditInt and EditDouble [FEATURE REQUEST]
Goto Forum:
  


Current Time: Fri Oct 22 22:33:37 CEST 2021

Total time taken to generate the page: 0.00977 seconds