Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Urgent Need of Changes to IWBS
#1
Captain Kudzu,

I have made changes to TIWBSRegion that I would like you to consider adding to the source code that you distribute as part of IW.

As you know, the following code is perfectly acceptable and normal with Bootstrap 3:

<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
   <span class="icon-bar"></span>
   <span class="icon-bar"></span>
   <span class="icon-bar"></span>                        
</button>


But TIWBSButton descends from TIWBSCustomControl, which descends from TIWCustomControl and implements the interface IIWBSComponent. As such it cannot act as a container. I have written about this problem before.

I have realized that this problem needs an immediately solution. TIWBSButton can remain, but I needed BSRegion to be usable as a span and as a button. Hence my changes:

type
  TIWBSRegionTagType = (bsttDiv, bsttH1, bsttH2, bsttH3, bsttH4, bsttH5, bsttH6, bsttP, bsttSpan, bsttButton);

const
  aIWBSRegionTagType: array[bsttDiv..bsttButton] of string = ('div', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p', 'span', 'button');

Without these changes I cannot use Delphi and IntraWeb to realize my designs, unless I go with Templates. But that's not the point -- the point is that I want to use IWBootstrap, if for no other reason than to prove that it can be done for any design, not just simple ones.

If I am missing something, please help me understand.

Loren
Reply
#2
(10-07-2018, 02:36 PM)LorenSzendre Wrote: Captain Kudzu,

I have made changes to TIWBSRegion that I would like you to consider adding to the source code that you distribute as part of IW.

As you know, the following code is perfectly acceptable and normal with Bootstrap 3:

<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
   <span class="icon-bar"></span>
   <span class="icon-bar"></span>
   <span class="icon-bar"></span>                        
</button>


But TIWBSButton descends from TIWBSCustomControl, which descends from TIWCustomControl and implements the interface IIWBSComponent. As such it cannot act as a container. I have written about this problem before.

I have realized that this problem needs an immediately solution. TIWBSButton can remain, but I needed BSRegion to be usable as a span and as a button. Hence my changes:

type
  TIWBSRegionTagType = (bsttDiv, bsttH1, bsttH2, bsttH3, bsttH4, bsttH5, bsttH6, bsttP, bsttSpan, bsttButton);

const
  aIWBSRegionTagType: array[bsttDiv..bsttButton] of string = ('div', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p', 'span', 'button');

Without these changes I cannot use Delphi and IntraWeb to realize my designs, unless I go with Templates. But that's not the point -- the point is that I want to use IWBootstrap, if for no other reason than to prove that it can be done for any design, not just simple ones.

If I am missing something, please help me understand.

Loren

Loren,

If you would like another beta tester for your changes, please send me the changed library files / test app and I will install / test! 

All the best,

Shane
Reply
#3
Sure, that would be great! But I just found an error with my last change -- when I set the IWBSRegion TagType to bsttButton -- I got an error reading the TagType property.

So now I'm just using OnHTMLTag to morph the div into a button. It works, but I for purposes of maintainability of code, I would like to use my first solution.

It's hard when you come back to code 3 months later and you look at the form -- not realizing that you have a raft of code morphing one tag type into something else!
Reply
#4
(10-07-2018, 03:14 PM)LorenSzendre Wrote: Sure, that would be great! But I just found an error with my last change -- when I set the IWBSRegion TagType to bsttButton -- I got an error reading the TagType property.

So now I'm just using OnHTMLTag to morph the div into a button. It works, but I for purposes of maintainability of code, I would like to use my first solution.

It's hard when you come back to code 3 months later and you look at the form -- not realizing that you have a raft of code morphing one tag type into something else!

Understand. 

What is your native language? Your English is very good!

All the best,

Shane
Reply
#5
I'm an American)) But I have lived in Ukraine, Poland, Russia, South Africa and Cyprus, so I have picked up a few other languages along the way.
Reply
#6
Big Grin 
I thought so but I have learned to never be presumptuous!

Now I know why you new reference to Aggie  Wink!

Well, starting new empty project!

All the best,

Shane
Reply
#7
I just had to alter the source code for BSRegion again!

I think that long term I will be creating new components to add to the IWBootstrap library, instead of morphing BSRegion into "be all" component.

The whole idea of having a group of components is to be able to add the proper component in the proper container and only have to alter a few properties -- not to have events that morph something from Type X into Type Y
Reply
#8
Oy, I'm in need of a bigger brain here. It's easy to make a region think it's a button. But then you lose the events of TIWCustomControl.

So Chad -- how do we get a component that is a container at design-time, and yet has all the necessary events?

I've been able to hack it into a beautifully functioning Bootstrap demo app, but I'm not happy with the hack. It must be done right.

I'll post the latest version of my demo app soon.
Reply
#9
I'm not captain (and I don't like boats) but if you send me your change file(s) I can compare it with my code base and see what I can do.
Reply
#10
(10-08-2018, 09:04 AM)Alexandre Machado Wrote: I'm not captain (and I don't like boats) but if you send me your change file(s) I can compare it with my code base and see what I can do.

Alright General Machado))

The altered IWBSRegion unit is included in the 2nd version of the IW Bootstrap demo project I uploaded yesterday.

At first I thought I needed to comment out the 4 lines at the bottom of InternalRenderCss(), but then I realized that the BSRegion automatically adds the first child div. So this change probably isn't needed.

The heart of the change was adding bsttAnchor, bsttButton, bsttListItem, bsttSpan, bsttUnorderedList.

The reason is because when using IWBootstrap, you have regions containing regions containing regions so many times, that choosing the TagType is vastly superior that implementing OnHTMLTag. When you choose the TagType, the Tag is displayed at design-time in the upper-right corner.

It actually takes quite a bit of time to "visually" design a significant Bootstrap page using these components. Whereas if you look at a section of HTML with any code editor with syntax highlighting -- you can actually take in and comprehend a lot of code all at once. So anything to help declaratively is very useful.

And if you read the other posts, it is not just "nice", but 100% critical that there be anchors and buttons that can act as design-time containers. Otherwise the best you can do is dump a chunk of Bootstrapified HTML inside some "inner script" property -- which, if you do -- you lose the ability to attach events in the OI.

In short, as I see it -- it's not possible to use IWBootstrap "as is" to implement complex designs -- unless you make the changes that I made to BSRegion. And even then I had to do a little hacking to get my clicks to work.

Your feedback would be incredibly useful. I'm sure there's something I'm not seeing.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)