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 » Moving child ctrl, runtime, by mouse and keyboard
Moving child ctrl, runtime, by mouse and keyboard [message #24747] Fri, 29 January 2010 10:43 Go to next message
Sc0rch is currently offline  Sc0rch
Messages: 99
Registered: February 2008
Location: Russia, Rubtsovsk
Member

Hi all,

I've got non-trivial problem, no testcase, sorry =(

Need to move the ctrls in layout, at runtime, using mouse and keyboard. I need it for dynamic GUI editing. Please, give me a little advice how to realize this more optimally and more in upp-style.

And also, how to get the type of ctrl? something like GetDesc() ?

Best regards,
Anton
Re: Moving child ctrl, runtime, by mouse and keyboard [message #24779 is a reply to message #24747] Fri, 29 January 2010 18:45 Go to previous messageGo to next message
mrjt is currently offline  mrjt
Messages: 705
Registered: March 2007
Location: London
Contributor
You haven't really given enough information. If you only want to move ctrls around at runtime it's extremely easy to do. If you want something more like the Layout designer than you're better off doing something, well, like the Layout Designer Smile

You can use RTTI to determine the type of a Ctrl at runtime, 'dynamic_cast' or 'typeid' (I think).
Re: Moving child ctrl, runtime, by mouse and keyboard [message #25164 is a reply to message #24747] Sat, 13 February 2010 07:59 Go to previous messageGo to next message
Sc0rch is currently offline  Sc0rch
Messages: 99
Registered: February 2008
Location: Russia, Rubtsovsk
Member

Hello, mrjt!

You are right, something like LayoutDesigner, but for dynamic GUI constructing. You can see first results in attached archive (Win32 binaries).

FormEditor 0.0.5 supports:

- native view of widgets;
- dragging (one or group of widgets);
- copying (press the Ctrl-button, drag one object or group with right mouse button);
- selecting (combinations of left mouse button, Ctrl and Shift buttons);
- resizing (corner-style);
- storing GUI in xml-file;
- preview.

Dynamic GUI will be used with scripts and special servers.
Post, please, if you will found the bugs.

Best regards and sorry for my English
Anton
Re: Moving child ctrl, runtime, by mouse and keyboard [message #25165 is a reply to message #24747] Sat, 13 February 2010 09:33 Go to previous messageGo to next message
Sc0rch is currently offline  Sc0rch
Messages: 99
Registered: February 2008
Location: Russia, Rubtsovsk
Member

I've improved the xml-structure:

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE Form>
<Form width="600" height="450" align="1" valign="1" gridSizeX="10" gridSizeY="10">
	<content>
		<item x="10" y="10" cx="200" cy="60" align="1" valign="1">
			<language id="EN-EN"/>
			<name>Noname</name>
			<properties count="1">
				<property name="Type" value="Button"/>
			</properties>
		</item>
	</content>
	<language id="EN-EN"/>
	<name></name>
	<properties count="1">
		<property name="ToolWindow" value="false"/>
	</properties>
</Form>

[Updated on: Sat, 13 February 2010 09:36]

Report message to a moderator

Re: Moving child ctrl, runtime, by mouse and keyboard [message #25166 is a reply to message #25165] Sat, 13 February 2010 09:40 Go to previous messageGo to next message
fudadmin is currently offline  fudadmin
Messages: 1321
Registered: November 2005
Location: Kaunas, Lithuania
Ultimate Contributor
Administrator
It looks very nice!
Re: Moving child ctrl, runtime, by mouse and keyboard [message #25167 is a reply to message #25166] Sat, 13 February 2010 09:54 Go to previous messageGo to next message
Sc0rch is currently offline  Sc0rch
Messages: 99
Registered: February 2008
Location: Russia, Rubtsovsk
Member

fudadmin wrote on Sat, 13 February 2010 14:40

It looks very nice!

I'll publish the sources of the editor to Bazaar, when time comes. Too much to do =)
Re: Moving child ctrl, runtime, by mouse and keyboard [message #25188 is a reply to message #25167] Sat, 13 February 2010 16:55 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3355
Registered: August 2008
Senior Veteran
Sc0rch wrote on Sat, 13 February 2010 09:54

fudadmin wrote on Sat, 13 February 2010 14:40

It looks very nice!

I'll publish the sources of the editor to Bazaar, when time comes. Too much to do =)


Yes. It is very nice Smile


Best regards
Iñaki
Re: Moving child ctrl, runtime, by mouse and keyboard [message #25212 is a reply to message #25188] Sun, 14 February 2010 13:36 Go to previous messageGo to next message
Mindtraveller is currently offline  Mindtraveller
Messages: 917
Registered: August 2007
Location: Russia, Moscow rgn.
Experienced Contributor

Just tested.
Cool thing! Waiting for release version.
Re: Moving child ctrl, runtime, by mouse and keyboard [message #25249 is a reply to message #24747] Mon, 15 February 2010 15:15 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Sc0rch wrote on Fri, 29 January 2010 04:43

Hi all,

I've got non-trivial problem, no testcase, sorry =(

Need to move the ctrls in layout, at runtime, using mouse and keyboard. I need it for dynamic GUI editing. Please, give me a little advice how to realize this more optimally and more in upp-style.

And also, how to get the type of ctrl? something like GetDesc() ?

Best regards,
Anton



This is sort of tricky, as widget tends to "eat" your mouse inputs, right? Smile

In the past, I solved this issue by putting transparent with empty Paint on top of all widgets I wanted to move - that way, you will still see widgets through and you will get the desired mouse inputs redirected to your designer.

Type of ctrl - what about using dynamic_cast?

Mirek
Re: Moving child ctrl, runtime, by mouse and keyboard [message #25250 is a reply to message #25249] Mon, 15 February 2010 16:00 Go to previous messageGo to next message
Sc0rch is currently offline  Sc0rch
Messages: 99
Registered: February 2008
Location: Russia, Rubtsovsk
Member

luzr wrote on Mon, 15 February 2010 20:15


This is sort of tricky, as widget tends to "eat" your mouse inputs, right? Smile

In the past, I solved this issue by putting transparent with empty Paint on top of all widgets I wanted to move - that way, you will still see widgets through and you will get the desired mouse inputs redirected to your designer.



Hello, Mirek!

Yes, I'm using the same trick, transparent ctrl above other ctrls =).

luzr wrote on Mon, 15 February 2010 20:15


Type of ctrl - what about using dynamic_cast?


Thank you! I'll use it.
--
Re: Moving child ctrl, runtime, by mouse and keyboard [message #25465 is a reply to message #24747] Wed, 24 February 2010 21:25 Go to previous messageGo to next message
Sc0rch is currently offline  Sc0rch
Messages: 99
Registered: February 2008
Location: Russia, Rubtsovsk
Member

Hello! Sorry for delay.
New staff for testing!

FormEditor 0.2.3 supports:
- native view of widgets;
- resizing (corner-style, you can resize object/form/layout);
- dublicating (press the Ctrl-button, drag one object or group with right mouse button);
+ added serialization for main window (position);
* selection (select one widget, or (add to)/(toggle) selection, invert object/group selection);
  view of group selection changed;
* dragging (one widget or group of widgets); you can now drag the group by any point inside (it will
  be the option in next releases);
* storing GUI in xml-file; the xml-structure of file was changed;
* preview (there is a temporary file now named "FormEditor.view");
+ added support of child forms (add form-object, write path to form, apply changes);
+ added some operations to group of widget (just select the group and try the buttons: left click
  aligns the objects, left click + Ctrl moves widgets to border);
+ added properties of the form (Form - Properties);
+ added basic storing and loading commands for layout-files (File menu);
+ added some dynamic properties for objects (not all of them).



Form 0.0.8:
- loading widgets and properties from xml-files;
+ children-forms;
+ scripting using Esc;


XML example:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE Form>
<Form width="300" height="260" align="left" valign="top" gridSizeX="10" gridSizeY="10">
	<content>
		<item x="10" y="40" cx="160" cy="220" align="1" valign="1">
			<language id="EN-EN"/>
			<name>Numbers</name>
			<properties>
				<property name="Frame" value="Default frame"/>
				<property name="Type" value="Form"/>
				<property name="PathType" value="Relative"/>
				<property name="Path" value="Calc-Buttons.form"/>
			</properties>
		</item>
		<item x="180" y="40" cx="110" cy="170" align="1" valign="1">
			<language id="EN-EN"/>
			<name>Operations</name>
			<properties>
				<property name="Frame" value="Default frame"/>
				<property name="Type" value="Form"/>
				<property name="PathType" value="Relative"/>
				<property name="Path" value="Calc-Operations.form"/>
			</properties>
		</item>
		<item x="20" y="10" cx="260" cy="30" align="1" valign="1">
			<language id="EN-EN"/>
			<name>Result view</name>
			<properties>
				<property name="Frame" value="Default frame"/>
				<property name="Type" value="EditField"/>
			</properties>
		</item>
	</content>
	<language id="EN-EN"/>
	<name></name>
	<properties>
		<property name="GridVisible" value="true"/>
		<property name="GridBinding" value="true"/>
		<property name="MaximizeBox" value="0"/>
		<property name="MinimizeBox" value="1"/>
		<property name="Sizeable" value="0"/>
		<property name="ToolWindow" value="0"/>
		<property name="ScrollContent" value="false"/>
	</properties>
</Form>


List of ESC-functions (digit is the count of parameters):
ShowMessageBoxOK (2: title, message)
CreateForm (2: name, xml-file)
RemoveForm (1: name)
RunForm (1: name)
CreateVar (2: var, value)
RemoveVar (1: var)
SetVar (2: var, value)
GetVar (1: var)
SetWidgetData (3: form, widget, value)
GetWidgetData (2: form, widget)


ESC-script examples:

Initial script:
Main()
{
	if (CreateForm("Calc", "Calc.form"))
	{
		RunForm("Calc");
	}
}

Calculator script (not full):
OnInit()
{
	CreateVar("Last", "0");
	CreateVar("Buffer", "0");
	CreateVar("Operation", "0");
	CreateVar("NewNumber", "1");

	SetWidgetData("Calc", "Result view", "0");
}

OnDrop()
{
	RemoveVar("Last");
	RemoveVar("Buffer");
	RemoveVar("Operation");
	RemoveVar("NewNumber");
}

SetBuffer(value)
{
	SetVar("Last", GetVar("Buffer"));
	SetWidgetData("Calc", "Result view", value);
	SetVar("Buffer", value);
}

OnAction(action)
{
	switch(action)
	{
		case "Clear":	SetBuffer(0);
						SetVar("Last", 0);
						return;

		case "+":	if (GetVar("Operation") == "+")
					{
						SetBuffer(	to_number(GetVar("Last")) +
									to_number(GetVar("Buffer")) );
						SetVar("Last", 0);
					}

					SetVar("Operation", action);
					SetVar("NewNumber", "1");
					return;

		case "-": 	if (GetVar("Operation") == "-")
					{
						SetBuffer(	to_number(GetVar("Last")) -
									to_number(GetVar("Buffer")) );
						SetVar("Last", 0);
					}

					SetVar("Operation", action);
					SetVar("NewNumber", "1");
					return;

		case "*": 	

...



Please, test the editor and report the bugs!

Best regards and thanks for support!
Anton


P.S. Sorry, if some elements are not good for now! For example, the resizing of the main layout is not easy, and more else... Trying to fix!

P.P.S. Sorry for calculator script, it was created quickly with not very effective script system. Just for example.

P.P.P.S. I don't sure, create new topic for editor or not. What do you think?
  • Attachment: FormEditor.rar
    (Size: 1.01MB, Downloaded 257 times)
  • Attachment: Example.rar
    (Size: 1.00MB, Downloaded 256 times)
Re: Moving child ctrl, runtime, by mouse and keyboard [message #25466 is a reply to message #25465] Wed, 24 February 2010 22:05 Go to previous messageGo to next message
andrei_natanael is currently offline  andrei_natanael
Messages: 262
Registered: January 2009
Experienced Member
Hi,
I like the idea behind this form editor.
I have a suggestion and 2 bugs to report.
Would be good to set minimum size for window.
Bug 1 - the form editor window is not closing (pressing close button, or Exit from menu)
Bug 2 - when resizing the edited window the dashed frame which surround it isn't show when the window grow but only when it decrease.
Re: Moving child ctrl, runtime, by mouse and keyboard [message #25474 is a reply to message #25466] Thu, 25 February 2010 10:21 Go to previous messageGo to next message
Sc0rch is currently offline  Sc0rch
Messages: 99
Registered: February 2008
Location: Russia, Rubtsovsk
Member

andrei_natanael wrote on Thu, 25 February 2010 03:05


Bug 1 - the form editor window is not closing (pressing close button, or Exit from menu)


Exe-files was tested in XP and Win7 (three computers). I didn't find the bug. Any details?
I know, that Break() function in TopWindow-class not work sometimes . Or I must click several times to close window.
I don't know why it happens. Does anybody know more optimal way to close the window?
andrei_natanael wrote on Thu, 25 February 2010 03:05


Bug 2 - when resizing the edited window the dashed frame which surround it isn't show when the window grow but only when it decrease.

Yes, I know. There are the historical reasons (scrolling of the content, position of the objects and painting - all of this based on Form-ctrl GetRect() func; so RectTracker can't draw itself outside of Form-ctrl). I'll try to fix it.

Added: I'll try to download Win32 SDK, maybe, the bug with exiting will disappear...

[Updated on: Thu, 25 February 2010 12:55]

Report message to a moderator

Re: Moving child ctrl, runtime, by mouse and keyboard [message #25483 is a reply to message #25474] Thu, 25 February 2010 14:12 Go to previous messageGo to next message
andrei_natanael is currently offline  andrei_natanael
Messages: 262
Registered: January 2009
Experienced Member
About Bug 1 i cannot reproduce it anymore. It happened only first time and I killed the application from task manager to exit it.
Re: Moving child ctrl, runtime, by mouse and keyboard [message #26686 is a reply to message #24747] Wed, 19 May 2010 12:46 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3355
Registered: August 2008
Senior Veteran
Hello Sc0rch

Some questions:

- Are you planning to include it in Bazaar?

- Could your library easily include widgets (controls) different than the included in CtrlLib?


Best regards
Iñaki
Re: Moving child ctrl, runtime, by mouse and keyboard [message #26693 is a reply to message #26686] Wed, 19 May 2010 16:20 Go to previous message
Sc0rch is currently offline  Sc0rch
Messages: 99
Registered: February 2008
Location: Russia, Rubtsovsk
Member

koldo wrote on Wed, 19 May 2010 17:46

- Are you planning to include it in Bazaar?


Hello, Koldo! If you help, yes.
First release here: http://www.ultimatepp.org/forum/index.php?t=msg&th=5217& amp; amp; amp;start=0&

koldo wrote on Wed, 19 May 2010 17:46


- Could your library easily include widgets (controls) different than the included in CtrlLib?

At compile-time only. Any Ctrl-based widget can be added. I'm not sure how easy it =) code needs refactoring (too many different hacks used to achieve result, and also I'm not a professional coder).

Best regards!
Anton

[Updated on: Wed, 19 May 2010 16:20]

Report message to a moderator

Previous Topic: Proposal: add IsReadOnly() handling inside ButtonOption
Next Topic: Is there an example/links how to use X11 DHCtrl?
Goto Forum:
  


Current Time: Thu Mar 28 21:00:57 CET 2024

Total time taken to generate the page: 0.01331 seconds