Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 10 of 20 total
Thread Banner / Paging Strategy
Fri, Jul 24 2015 4:15 PMPermanent Link

Boris B

Most sites have some sort of a banner (logo, login/logout links, other information) that includes some sort of a navigation bar to access various areas of the application (e.g., home, products, support, about).

What's the best strategy for implementing this in EWB 2?

I've created my first page with a complex banner, but now I want to add other pages/forms which will have varying vertical sizes necessarily.  I'm unsure how to either reuse the complex banner on subsequent forms or how to manage multiple "panels" of content to display on that one page/form.
Fri, Jul 24 2015 4:40 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Boris,

<< Most sites have some sort of a banner (logo, login/logout links, other information) that includes some sort of a navigation bar to access various areas of the application (e.g., home, products, support, about).

What's the best strategy for implementing this in EWB 2? >>

The best strategy for reusability is always to create a custom control for the banner.  That will give the maximum benefit without getting into inheritance issues, etc.

The next best strategy is to make the banner be a single form unto itself, and then parent an instance of that form dynamically into whatever container you want at runtime.

Tim Young
Elevate Software
www.elevatesoft.com
Fri, Jul 24 2015 5:11 PMPermanent Link

Boris B

In .NET (and even Delphi), I'd certainly create the banner as a custom control.

However, I'm (embarrassingly) uncertain as to how to visually design a custom control in EWB 2.  "Add Component" gives me a form definition without a designer surface...?  The Interface designer allows me to define elements, but not from the toolbar, although I think I might be able to use the Interface designer to do what I need to in the banner (but not as easily as I can on a TForm).

The banner of this support forum is actually representative of what I need - a logo, page links, bread crumb, login/out display.

Any tips, guidance appreciated :D
Fri, Jul 24 2015 7:11 PMPermanent Link

Boris B

Turns out your "next best strategy" is essentially what I was looking for.

Using a TForm to visual design my banner works really well.  (Of course, I have to remove it form the auto-created forms list.)

Then, in each other form, I drop a TBasicPanel at the top of it, and in the OnCreate method I create an instance of the banner form and set its Parent property to the basic panel.

Works simply and well Smile
Sun, Jul 26 2015 5:26 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Boris,

<< However, I'm (embarrassingly) uncertain as to how to visually design a custom control in EWB 2.  "Add Component" gives me a form definition without a designer surface...?  The Interface designer allows me to define elements, but not from the toolbar, although I think I might be able to use the Interface designer to do what I need to in the banner (but not as easily as I can on a TForm). >>

You should probably start with this video:

https://www.youtube.com/watch?v=dZEQBqP8NME

EWB has changed a bit since then, but the core ideas are all still the same.

The steps are:

1) Determine the general makeup of the control.  Specifically, which UI elements will be necessary to display/edit all of the information, and whether or not they will need to be separate sub-controls for property editing or event management purposes.  By default, events are dispatched from the target UI element to any TControl instance that is associated with the same, or a parent of the same, UI element.  For example, a TPanel control has a few sub-controls:  one for the caption bar, one for the minimize button, and one for the close button.  It also has an outer UI element and an inner, client UI element.  This means that any events that happen on any of the UI elements that make up the caption bar (mouse down, etc.) are dispatched to the caption bar control instance, which can forward them on to the parent panel instance, if so desired.  However, the client element *always* dispatches its events to the parent panel instance because it does *not* have any TControl instance associated with it.

2) Define a control interface for each TControl-descendant instance that will be used in your control.  For controls that don't require any state transitions, such as containers, this is fairly easy.  For input controls with state transitions, this takes a bit more time because you'll want to define states for the normal, focused, disabled, hot, etc. states.

There are some more wrinkles as controls become more complicated.  The best way to normally start is to grab the source unit for the control that most matches what you need, and use it as a starting point.

<< The banner of this support forum is actually representative of what I need - a logo, page links, bread crumb, login/out display. >>

In that case, you may want to create separate controls for the page links and bread crumbs, and then use those in a form template along with a standard TImage for the logo.

Tim Young
Elevate Software
www.elevatesoft.com
Mon, Jul 27 2015 9:02 AMPermanent Link

Boris B

Thanks for the detailed reply! =)
Wed, Aug 5 2015 9:03 AMPermanent Link

Matthew Jones

Boris B wrote:

> Most sites have some sort of a banner (logo, login/logout links,
> other information) that includes some sort of a navigation bar to
> access various areas of the application (e.g., home, products,
> support, about).
>
> What's the best strategy for implementing this in EWB 2?
>
> I've created my first page with a complex banner, but now I want to
> add other pages/forms which will have varying vertical sizes
> necessarily.  I'm unsure how to either reuse the complex banner on
> subsequent forms or how to manage multiple "panels" of content to
> display on that one page/form.

Just back from holiday, so a little late, but EWB supports "docking" of
the forms in other forms. So my applications, like my web shop, have
the "welcome" page with a panel at the top with the navigation buttons,
and the code then just creates the relevant form with the bottom
section (a panel filling the available space) as the parent.

  if not assigned(frmSummary) then
     frmSummary := TfrmSummary.Create(pnlParent);
  SetActiveForm(frmSummary);



procedure TfrmWelcome.SetActiveForm(xForm: TForm);
begin
   if assigned(m_xActiveForm) then
   begin
       m_xActiveForm.Hide;
   end;

   m_xActiveForm := xForm;
   if assigned(m_xActiveForm) then
   begin                          
       m_xActiveForm.Show;
       PositionActiveForm;
   end;
end;

procedure TfrmWelcome.PositionActiveForm;
begin                                    
   if assigned(m_xActiveForm) then
   begin                    
       m_xActiveForm.Left := (pnlParent.ClientWidth -
m_xActiveForm.Width) div 2;
       m_xActiveForm.Height := pnlParent.ClientHeight;
   end;
end;

--

Matthew Jones
Wed, Aug 5 2015 7:26 PMPermanent Link

Boris B

Thanks!
Sun, Aug 9 2015 11:06 AMPermanent Link

Mark Brooks

Slikware

Avatar

>>Boris B wrote:
>>
>>Most sites have some sort of a banner (logo, login/logout links, other information) that includes some sort of a >>navigation bar to access various areas of the application (e.g., home, products, support, about).
>>
>>What's the best strategy for implementing this in EWB 2?

Also back from holiday but thought that I'd chip-in too. For my target audience I have found it important for the browser "back" and "forward" actions to be able to navigate my app "views". Furthermore, there is great benefit in the user being able to save a "view URL" and return to it later. With this is mind I use the URL "hash" to navigate between views in my app. Just a thought - it works brilliantly for me - also means you don't need to confuse the user with a "back button" even though EWB apps are single-page.

Good luck
Mark
Sun, Aug 9 2015 2:47 PMPermanent Link

Uli Becker

Mark,

I remember there was a pretty detailed discussion about that. Unfortunately I can't find it. Do you remember it?

Thanks Uli
Page 1 of 2Next Page »
Jump to Page:  1 2
Image