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  |
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 #25164 is a reply to message #24747] |
Sat, 13 February 2010 07:59   |
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   |
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 #25249 is a reply to message #24747] |
Mon, 15 February 2010 15:15   |
 |
mirek
Messages: 14255 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? 
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   |
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? 
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   |
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?
|
|
|
|
Re: Moving child ctrl, runtime, by mouse and keyboard [message #25474 is a reply to message #25466] |
Thu, 25 February 2010 10:21   |
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 #26693 is a reply to message #26686] |
Wed, 19 May 2010 16:20  |
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
|
|
|
Goto Forum:
Current Time: Sat Apr 26 23:13:35 CEST 2025
Total time taken to generate the page: 0.02954 seconds
|