Oberon Community Platform Forum
December 07, 2019, 07:49:01 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: GroupPanel.AddContent IMHO has Bug...  (Read 8185 times)
BohdanT
Sr. Member
****
Posts: 271


Life is difficult, but fortunately is short!


WWW
« on: May 06, 2008, 05:47:21 AM »

now:
Code:
PROCEDURE AddContent*(content: XML.Content);
BEGIN
centerContent.AddContent(content);
END AddContent;
IMHO need that, because they did not set its properties:
Code:
PROCEDURE AddContent*(content: XML.Content);
BEGIN
IF content IS WMComponents.Component THEN
centerContent.AddContent(content);
ELSE
AddContent^(content);
END;
END AddContent;
Logged
staubesv
Administrator
Sr. Member
*****
Posts: 387



« Reply #1 on: June 24, 2008, 08:10:04 AM »

Could you please describe this in a bit more detail?
Logged
BohdanT
Sr. Member
****
Posts: 271


Life is difficult, but fortunately is short!


WWW
« Reply #2 on: June 24, 2008, 02:40:02 PM »

Long time ago I wrote this .... Wink
For how many I can remember, the case is what:
1) The problem arises when a component is read from XML.    
I.e. when I want to create a form from XML-file, as does ComponentViewer.Mod.
2) properties such as the caption, captionFont, etc. not set, because everything is transmitted in centerContent.AddContent(content)

If I am wrong or incorrectly remembered the reasons I remember in more detail and cite examples of a couple of days.
Logged
BohdanT
Sr. Member
****
Posts: 271


Life is difficult, but fortunately is short!


WWW
« Reply #3 on: July 01, 2008, 04:45:57 PM »

Here is an example of XML-file:
Code:
<Panel>
<Properties>
<Bounds>
<Left>0</Left>
<Top>0</Top>
<Width>240</Width>
<Height>240</Height>
</Bounds>
<Alignment>5</Alignment>
<FillColor>40FFFFFF</FillColor>
</Properties><GroupPanel>
<Properties>
<Bounds>
<Left>64</Left>
<Top>83</Top>
<Width>140</Width>
<Height>141</Height>
</Bounds>
<Alignment>0</Alignment>
<Caption>Test Group Panel</Caption>
</Properties>
<Label>
<Properties>
<Bounds>
<Left>17</Left>
<Top>27</Top>
<Width>80</Width>
<Height>32</Height>
</Bounds>
<Alignment>0</Alignment>
<Caption>Label</Caption>
<TextColor>     0FF</TextColor>
</Properties>
</Label>
</GroupPanel>
</Panel>

   
To test I use:
Code:
ComponentViewer.Open Test.XML

At the first ScreenShot how now works.
In the second, when to make the proposed change.



* 1.bmp (189.09 KB, 245x263 - viewed 486 times.)

* 2.bmp (202.25 KB, 254x271 - viewed 630 times.)
Logged
staubesv
Administrator
Sr. Member
*****
Posts: 387



« Reply #4 on: July 02, 2008, 09:47:25 AM »

Thank you very much for the detailed bug description and its solution!

Fixed in revision 1333.
« Last Edit: July 02, 2008, 09:55:05 AM by staubesv » Logged
BohdanT
Sr. Member
****
Posts: 271


Life is difficult, but fortunately is short!


WWW
« Reply #5 on: July 02, 2008, 12:51:46 PM »

Always happy to help!

But in reality this is not the last problem.
I am a bit "simplified" XML-file for example.

These problems arose when writing forms designer.
Next problem I bypassed by using the additional component, which only shows the components and self save and load data from XML.
But in principle it would be interesting to discuss them.

Saving edited form I am doing so:

Code:
PROCEDURE Save(sender, data: ANY);
VAR f : AosFS.File; out : AosFS.Writer;
BEGIN
f := AosFS.New("form.XML");
AosFS.OpenWriter(out, f, 0);
dependent.panel.Write(out, 0);
out.Update();
AosFS.Register(f)
END Save;

In this case, components, which in itself contain additional controls, such ScrollBar, GroupPanel, retain them in XML.
Code:
<Panel>
<Properties>
<Bounds>
<Left>0</Left>
<Top>0</Top>
<Width>380</Width>
<Height>338</Height>
</Bounds>
<Alignment>5</Alignment>
<FillColor>-3B3B3B01</FillColor>
</Properties><Scrollbar>
<Properties>
<Bounds>
<Left>366</Left>
<Top>0</Top>
<Width>14</Width>
<Height>338</Height>
</Bounds>
<Alignment>3</Alignment>
<TakesFocus>false</TakesFocus>
<Pos>40</Pos>
</Properties><Button>
<Properties>
<Bounds>
<Left>0</Left>
<Top>0</Top>
<Width>338</Width>
<Height>0</Height>
</Bounds>
<Alignment>1</Alignment>
<Visible>false</Visible>
<TakesFocus>false</TakesFocus>
<IsRepeating>true</IsRepeating>
</Properties>
</Button>

<Button>
<Properties>
<Bounds>
<Left>0</Left>
<Top>0</Top>
<Width>338</Width>
<Height>0</Height>
</Bounds>
<Alignment>3</Alignment>
<Visible>false</Visible>
<TakesFocus>false</TakesFocus>
<IsRepeating>true</IsRepeating>
</Properties>
</Button>
<Button>
<Properties>
<Bounds>
<Left>0</Left>
<Top>0</Top>
<Width>14</Width>
<Height>14</Height>
</Bounds>
<Alignment>2</Alignment>
<Visible>true</Visible>
<TakesFocus>false</TakesFocus>
<IsRepeating>true</IsRepeating>
</Properties>
</Button>
<Button>
<Properties>
<Bounds>
<Left>0</Left>
<Top>324</Top>
<Width>14</Width>
<Height>14</Height>
</Bounds>
<Alignment>4</Alignment>
<Visible>true</Visible>
<TakesFocus>false</TakesFocus>
<IsRepeating>true</IsRepeating>
</Properties><Timer>
<Properties>
<enabled>false</enabled>
</Properties>
</Timer>

</Button>
<Button>
<Properties>
<Bounds>
<Left>0</Left>
<Top>14</Top>
<Width>14</Width>
<Height>99</Height>
</Bounds>
<Alignment>2</Alignment>
<TakesFocus>false</TakesFocus>
<IsRepeating>true</IsRepeating>
<IsHorizontal>false</IsHorizontal>
<Effect3d>0</Effect3d>
</Properties>
</Button>
<Button>
<Properties>
<Bounds>
<Left>0</Left>
<Top>175</Top>
<Width>14</Width>
<Height>149</Height>
</Bounds>
<Alignment>4</Alignment>
<TakesFocus>false</TakesFocus>
<IsRepeating>true</IsRepeating>
<IsHorizontal>false</IsHorizontal>
<Effect3d>0</Effect3d>
</Properties><Timer>
<Properties>
<enabled>false</enabled>
</Properties>
</Timer>

</Button>
<Button>
<Properties>
<Bounds>
<Left>0</Left>
<Top>113</Top>
<Width>14</Width>
<Height>62</Height>
</Bounds>
<Alignment>5</Alignment>
<TakesFocus>false</TakesFocus>
<IsHorizontal>false</IsHorizontal>
</Properties>
</Button>
</Scrollbar>
</Panel>
When loading this XML-file, creates two sets of internal controls.
One set which created the constructor &Init(), and the second will read from the XML-file.

I see a solution to this problem, establish an additional component-flag, which show that this is an internal component and it does not need to save to XML.
   
I am not sure that bug, may by  in other applications may well work correctly.


* 3.bmp (334.09 KB, 337x338 - viewed 481 times.)
« Last Edit: July 02, 2008, 12:57:49 PM by BohdanT » Logged
staubesv
Administrator
Sr. Member
*****
Posts: 387



« Reply #6 on: July 02, 2008, 01:09:28 PM »

I'm currently doing some experiments building a GUI builder tool. I'm not yet so far to make something persistent, but I will have the same problem as you describe above soon Wink

Introducing a flag to indicate that some sub-components will be created by the parent component when it is instantiated seems to be the right direction, but we also need the properties of that sub-components (e.g. color of buttons used by scrollbars).
Finally, the XML description needs to provide these properties in a way they can be assigned to the right sub-components (maybe the sub-components need names for that purpose) without creating them.
Logged
BohdanT
Sr. Member
****
Posts: 271


Life is difficult, but fortunately is short!


WWW
« Reply #7 on: July 02, 2008, 01:27:51 PM »

Quote
I'm currently doing some experiments building a GUI builder tool.
Can I send their sources?  Wink
I moved up to a certain stage. This problem I have already bypassed.
Save and load form operate normally.
Partially, made a generation code, component repository, etc.
Now fighting properties edition, etc.

Quote
but we also need the properties of that sub-components

But access to the properties of sub-components feasible only through the properties of the parent component (may I am wrong, but have not yet seen a different situation).  Huh

Quote
Finally, the XML description needs to provide these properties in a way they can be assigned to the right sub-components
       
We need to think ...  Huh
Logged
BohdanT
Sr. Member
****
Posts: 271


Life is difficult, but fortunately is short!


WWW
« Reply #8 on: July 02, 2008, 01:43:46 PM »

Quote
Introducing a flag to indicate that some sub-components will be created by the parent component when it is instantiated seems to be the right direction, but we also need the properties of that sub-components (e.g. color of buttons used by scrollbars).

If this flag is on, no need create sub-component, and no more do...
Logged
staubesv
Administrator
Sr. Member
*****
Posts: 387



« Reply #9 on: July 15, 2008, 01:18:28 PM »

Yes, otherwise internals of the visual components would be visible outside...
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!