Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 10 of 11 total
Thread Wrap control inside a <DIV></DIV> tag?
Sat, Oct 3 2015 1:51 PMPermanent Link

PA

Hello!

Is it possible to wrap any control inside a <DIV></DIV> tag at design-time, so that this control will become a DIV DOM element in the browser at run-time?
Sat, Oct 3 2015 2:10 PMPermanent Link

PA

Ooops, this could lead to a misunderstanding, as any control will become a DIV at run-time in the browser. My question was about wrapping this control-DIV inside another custom DIV with custom attributes at design-time. Or to assign custom DIV attributes for a control at design-time? This would add a lot of flexibility and extend the possibilities hugely!
Sat, Oct 3 2015 2:14 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

PA,

<< Ooops, this could lead to a misunderstanding, as any control will become a DIV at run-time in the browser. My question was about wrapping this control-DIV inside another custom DIV with custom attributes at design-time. Or to assign custom DIV attributes for a control at design-time? This would add a lot of flexibility and extend the possibilities hugely! >>

What exactly are you trying to accomplish ?

The quick answer is no, simply because for an EWB application there shouldn't be any DIV elements present in the entire active document that aren't managed by EWB already (TBrowser, being the exception).

Tim Young
Elevate Software
www.elevatesoft.com
Sat, Oct 3 2015 2:18 PMPermanent Link

PA

This could be done by implementing a CustomDivAttributes property in the TControl class. The compiler then would add the attributes from this property to the control DIV. Very easy to implement.

This would be fantastic!
Sat, Oct 3 2015 2:24 PMPermanent Link

PA

As an example, this would allow to add the draggable attribute to a control.
Sat, Oct 3 2015 2:43 PMPermanent Link

PA

More generally:

This would allow to ADD or REMOVE ANY specific attribute to a control - both at design-time and at run-time.

For example, at run-time:

MyControl.CustomDivAttributes.Add('draggable="true"');

or:

// removes attribute with specific value:
MyControl.CustomDivAttributes.Remove('draggable="true"');

or:

// removes attribute with any value:
MyControl.CustomDivAttributes.Remove('draggable');

or:

MyControl.CustomDivAttributes.Replace('draggable="true"', 'draggable="false"');
Sat, Oct 3 2015 3:20 PMPermanent Link

PA

Well, the WebDOM unit contains the TDOMElement class which implements several attribute methods.

But how can I typecast a TControl to a TDOMElement?

When I write:

TDOMElement(BasicPanel1).setAttribute('Id', 'test');

then the compiler complains with:

[Error] Unit1.wbs (27,3): The referenced class TDOMElement is not compatible with the expression being cast

So how can I use a TControl as a TDOMElement?
Sat, Oct 3 2015 4:26 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

PA,

<< This could be done by implementing a CustomDivAttributes property in the TControl class. The compiler then would add the attributes from this property to the control DIV. Very easy to implement.

This would be fantastic! >>

My initial reaction is no, that probably won't happen with EWB.  It's too easy for the end developer to break behaviors doing that, and it circumvents any encapsulation offered by the control/component classes in the component library.

Tim Young
Elevate Software
www.elevatesoft.com
Sat, Oct 3 2015 4:27 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

PA,

<< So how can I use a TControl as a TDOMElement? >>

You can't.

Tim Young
Elevate Software
www.elevatesoft.com
Sat, Oct 3 2015 4:31 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

PA,

<< As an example, this would allow to add the draggable attribute to a control. >>

If you want to do this, then you should develop a *proper* descendant class that does this for you.

As I said before, you seem to be trying to force EWB to act like a JS+HTML+CSS tool-chain when it's whole entire *purpose* is to *not* use those development languages/formats.  The "draggable" attribute will not allow you to just start dragging around TControl-descendant instances and dropping them places.  Doing so will completely subvert everything being tracked by the EWB UI layer and cause it to fail because it won't be in synch with what is actually occurring in the browser.  EWB maintains this UI layer for many reasons:  design-time/run-time dual usage, platform independence, and performance (in the browser).

Tim Young
Elevate Software
www.elevatesoft.com
Page 1 of 2Next Page »
Jump to Page:  1 2
Image