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 » U++ Widgets - General questions or Mixed problems » Dynamic Ctrl frame
Dynamic Ctrl frame [message #53746] Sun, 26 April 2020 23:56 Go to next message
koldo is currently online  koldo
Messages: 3355
Registered: August 2008
Senior Veteran
I would like a coloured frame to appear around a control when the mouse passes over it, like the image:
index.php?t=getfile&id=6059&private=0
I have tried it in two ways:
- Playing with CtrlFrame. Unfortunately the colors are set as const, so they cannot be changed using MouseEnter()
- Working with another frame control. Unfortunately I do not know how a child control can adapt to parent, but staying around it, not inside it (as with SizePos()). I would prefer that this child frame control would be created automatically in the parent field construction.

Thank you.


Best regards
Iñaki
Re: Dynamic Ctrl frame [message #53747 is a reply to message #53746] Mon, 27 April 2020 13:48 Go to previous messageGo to next message
Didier is currently offline  Didier
Messages: 680
Registered: November 2008
Location: France
Contributor
Hello Koldo,
I've been playing around with Chameleon lately and
I think you need to look at the EditField::Style.edge[]

struct Style : ChStyle<Style> {
		Color paper;
		Color disabled;
		Color focus;
		Color invalid;
		Color text, textdisabled;
		Color selected, selectedtext;
		Color selected0, selectedtext0; // If does not have focus...
		[b]Value edge[4];[/b] // border (for various active edge states)
		Value coloredge; // border mask for adding color, e.g. round borders with red Error
		bool  activeedge;
		int   vfm;
	};


and using:
enum {
	CTRL_NORMAL, CTRL_HOT, CTRL_PRESSED, CTRL_DISABLED,
	CTRL_CHECKED, CTRL_HOTCHECKED
};


So if you set edge[CTRL_HOT] to the right style image, you will probably get what you want

If you want to apply it to all EditField children, add at application init:
EditField::StyleDefault.Write().edge[CTRL_HOT] = YoureStyle; 


Note: this will only work for all EditField children ... not all Ctrls

If you want to apply it to a specfic Ctrl (not all), this should do the trick :
Quote:

static EditField::Style myCtrlStyle = EditField::StyleDefault();
myCtrlStyle.edge[CTRL_HOT] = YoureStyle;
...
myCtrl.SetStyle(myCtrlStyle);


You may need to replace 'EditField::Style' by '<EditFieldChildType>::Style' (depending on you're EditXxxx Ctrl)

[Updated on: Mon, 27 April 2020 13:54]

Report message to a moderator

Re: Dynamic Ctrl frame [message #53748 is a reply to message #53747] Mon, 27 April 2020 14:31 Go to previous messageGo to next message
koldo is currently online  koldo
Messages: 3355
Registered: August 2008
Senior Veteran
Thank you Didier

The idea was to apply it to a set of Ctrl, and that when the mouse is out of the Ctrl, it would remain selected until other Ctrl of the set is chosen.

It would be like a Switch (from a set of Ctrl, you choose just one), but with a visual signal around any Ctrl of the set, and that is activated just by hovering on the Ctrl instead of by clicking it.


Best regards
Iñaki
Re: Dynamic Ctrl frame [message #53767 is a reply to message #53748] Tue, 28 April 2020 15:51 Go to previous messageGo to next message
koldo is currently online  koldo
Messages: 3355
Registered: August 2008
Senior Veteran
Problem solved.
Quote:
- Playing with CtrlFrame. Unfortunately the colours are set as const, so they cannot be changed using MouseEnter()
Just creating a class derived from CtrlFrame but using dynamic coloring, instead of const, solved the issue. Smile
Thank you!


Best regards
Iñaki
Re: Dynamic Ctrl frame [message #53769 is a reply to message #53767] Tue, 28 April 2020 20:24 Go to previous message
Didier is currently offline  Didier
Messages: 680
Registered: November 2008
Location: France
Contributor
Hello Koldo,

I completelly mis-understood you're needs, but you found the solution Smile
Previous Topic: Overriding Key method disable tab browsing
Next Topic: SMTP library error?
Goto Forum:
  


Current Time: Thu Mar 28 13:57:57 CET 2024

Total time taken to generate the page: 0.01830 seconds