Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Make my own modal window
#1
Is there a way that I can make my own IWForm, and do something like I would do in Delphi, i.e. just call Form.ShowModal.

I have found the IWModalWindow component, but the annoying thing about it is that if I want to do something fancy, I put it on a region, and set the IWModalWindow.ContentElement.

That is simple, but it means that on my main form, I have all the stuff for my main form, then I also have a region that contains the components for the modal window. So the form has tons of components on it. I would like to move the components I need for the modal window onto a separate modal window to not clutter up my main form. Especially if the main form can launch 5 or 6 modal windows it would get crazy.

Can I make a new IWFrame and put the IWFrame as the ContentElement?
Reply
#2
(03-19-2018, 09:24 PM)davenovo Wrote: Is there a way that I can make my own IWForm, and do something like I would do in Delphi, i.e. just call Form.ShowModal.

I have found the IWModalWindow component, but the annoying thing about it is that if I want to do something fancy, I put it on a region, and set the IWModalWindow.ContentElement.

That is simple, but it means that on my main form, I have all the stuff for my main form, then I also have a region that contains the components for the modal window. So the form has tons of components on it. I would like to move the components I need for the modal window onto a separate modal window to not clutter up my main form. Especially if the main form can launch 5 or 6 modal windows it would get crazy.

Can I make a new IWFrame and put the IWFrame as the ContentElement?

That's a design issue.  You should not show the user the dialog contents before the dialog is displayed.  You should hide those regions behind your main region.  Set their visible property to false so they are not showing at runtime.  When you need to work on a dialog content region at design-time, just select it and choose Bring To Front from the Edit menu.
Reply
#3
Hi Daniel,

I am not worried about showing the dialog contents to ther user. I am worried about my own development experience. I will have tons of extra components on my form in the IDE, some of them for the form itself, some of them for the modal dialogs. Imagine if my main form can spawn 3 modal dialogs, each with 10 controls each. That means my main form has 30 extra controls, event handlers etc. In principle, you dont want to dump controls for 3 different forms on a single form in the IDE. Its very confusing.
Reply
#4
(03-19-2018, 10:59 PM)davenovo Wrote: Hi Daniel,

I am not worried about showing the dialog contents to ther user. I am worried about my own development experience. I will have tons of extra components on my form in the IDE, some of them for the form itself, some of them for the modal dialogs. Imagine if my main form can spawn 3 modal dialogs, each with 10 controls each. That means my main form has 30 extra controls, event handlers etc.  In principle, you dont want to dump controls for 3 different forms on a single form in the IDE. Its very confusing.

I guess I don't see it as confusing unless the controls are oddly out of place.  If the design calls for that much detail, then that's what you need.  I have forms that have seven dialogs with controls in each.  The IDE manages the controls with no effort on my part at all.  No sweat.

I keep the actual volume of code down by using classes to handle the detailed processing.  Many of my event handlers have a single line of code inside them.  I can see where it would become a burden if you are putting a lot of code inside the event handlers.  That's not the proper way to develop any longer.  Using classes allows you to keep the business logic separated from the interface.  I can simultaneously develop mobile and desktop interfaces for the same feature because all I'm doing is applying new skin.

The other alternative is to use different forms for everything that you would place into dialogs.  The downside is lots of forms to mange.  The upside is a very fast and responsive design.  I've used this approach a few times as well.
Reply
#5
Hi Daniel,

To each their own I suppose. If you want to keep 7 dialogs worth of controls on a single form and it works for you, that is awesome. Now, for those that want to keep a single dialogs worth of controls on a single form, and just open that form modally instead of just calling .Show, I am wondering if there is a way to do that.
Reply
#6
Hi, if you use templates, you can use a template modal, like images.
   
   
Reply
#7
Ahh, that looks interesting. What is a template? Is that an IW thing?

Do you mean templates like described here?
http://docs.atozed.com/docs.dll/developm...lates.html

If so, those are just for layout out and styling the form. That would not help the issue that I have all the buttons/events/code for the modal form embedded in the main form.
Reply
#8
(03-20-2018, 03:27 PM)davenovo Wrote: Ahh, that looks interesting. What is a template? Is that an IW thing?

Do you mean templates like described here?
http://docs.atozed.com/docs.dll/developm...lates.html

If so, those are just for layout out and styling the form. That would not help the issue that I have all the buttons/events/code for the modal form embedded in the main form.

Yes, you can use this example to do tests. My modals are in unique DFM, the trick is show parts of html div via JavaScript. But ALL buttons/events/code are in the same form of modals.
Code:
<!DOCTYPE html>
<html lang="pt-BR">
 <head>
 </head>
 <body>
   <!-- my NORMAL form -->
   <div class="wrapper">
     <header class="main-header">
      <!-- ETC, ETC, ETC -->
     </header>
   </div>
   <!-- /.wrapper -->

   <!-- First Modal, First IMAGE -->
   <div class="modal fade" id="EditModal" role="dialog" data-backdrop="false" data-keyboard="false">
     <div class="modal-dialog modal-lg" role="document">
      <!-- ETC, ETC, ETC -->
         <div class="modal-footer">
           <div class="row">
             <div class="col-md-5 col-xs-5 col-md-offset-7 col-xs-offset-7">
               <div class="btn-group btn-group-justified" role="group" aria-label="...">
                 <div class="btn-group" role="group" data-dismiss="modal">
                   <button type="button" class="btn btn-default" id="IWBUTTON_CANCELAR"><i class="fa fa-ban fa-fw fa-lg" aria-hidden="true"></i> Cancelar</button>
                 </div>
                 <div class="btn-group" role="group">
                   <button type="button" class="btn btn-primary" id="IWBUTTON_GRAVAR"><i class="fa fa-check fa-fw" aria-hidden="true"></i>  Salvar </button>
                 </div>
               </div>
             </div>
           </div>
         </div> <!--modal-footer-->
     </div><!-- /.modal-dialog -->
   </div><!-- /.modal -->

   <!-- Second Modal, Second IMAGE -->
   <div class="modal fade" id="EditContato" role="dialog" data-backdrop="false" data-keyboard="false">
     <div class="modal-dialog modal-md" role="document">
      <!-- ETC, ETC, ETC -->
         <div class="modal-footer">
           <div class="row">
             <div class="col-md-5 col-xs-5 col-md-offset-7 col-xs-offset-7">
               <div class="btn-group btn-group-justified" role="group" aria-label="...">
                 <div class="btn-group" role="group" data-dismiss="modal">
                   <button type="button" class="btn btn-default" id="IWBUTTON_CONCANCELAR"><i class="fa fa-ban fa-fw fa-lg" aria-hidden="true"></i> Cancelar</button>
                 </div>
                 <div class="btn-group" role="group">
                   <button type="button" class="btn btn-primary" id="IWBUTTON_CONGRAVAR"><i class="fa fa-check fa-fw" aria-hidden="true"></i>  Salvar </button>
                 </div>
               </div>
             </div>
           </div>
         </div> <!--modal-footer-->
     </div><!-- /.modal-dialog -->
   </div><!-- /.modal -->
 </body>
</html>

And you can SHOW/HIDE these modals:

Quote:WebApplication.CallBackResponse.AddJavaScriptToExecute('$("#EditModal").modal("show");') ;
Quote:WebApplication.CallBackResponse.AddJavaScriptToExecute( '$("#EditContato").modal("hide");' );
Reply
#9
(03-20-2018, 04:30 AM)davenovo Wrote: Hi Daniel,

To each their own I suppose. If you want to keep 7 dialogs worth of controls on a single form and it works for you, that is awesome. Now, for those that want to keep a single dialogs worth of controls on a single form, and just open that form modally instead of just calling .Show, I am wondering if there is a way to do that.

I do it the way you are talking about and it works fine.  I create my dialogs separately, then load them onto the form during the OnCreate.  I don't do it just to avoid having to deal with a busy design time form (though that is helpful), I do it so that I can use "common dialogs" (of my own requirements) on multiple forms easily.

I create my dialog "content" as frames.  As usual, fill the frame with a region then put your stuff on the region.  During form OnCreate I call a procedure that creates the frame (from the frame design time class) on the form, sets Parent to the form, Visible to false, and the frames' region visible to false.  Then you can use the regions in dialogs.  Don't forget to set RenderInvisibleControls to True on the dialogs.

It has been a while since I did all that, but I'll try to respond if you run into problems with it.  It should work without too much difficulty.

Dan
Reply
#10
Hi Dan,

Great. That sounds reasonable. I will give that a try.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)