4 Replies Latest reply on Nov 7, 2006 6:25 PM by Josh Johnson

    multi window flex application

    tibs75
      Hi there,

      I haven't dabbled with Flex but was wondering if Flex can do mulit windowed screens within one app, much like client side applications, say Photoshop, having mulitple images open at the same time? If so, or if there is a way to acheive this, can I please get directions to where to go and see examples.

      Basically I'd like it, it can be done, because it will mean one uniform method of programming language.

      I currently I have achived this through having a web/intranet application having multi window effect with all the bells/whistles (close,minimise,maximise,resize,movable,static (modal), having callbacks when closing, having callbacks when resizing, double clicking the title bar to minmise, maximise etc), having each window refresh within itself without refreshing the screen, and each div window refreshes seperately, mimicing a client side application, but all this is acheieved through a lot of different mechanisms, as I'll explain.

      - Interface
      * Menu system uses third party tool (xml) -> uses callback to call creation of window... done by js eval() function
      * Windows achived through javascript doing AJAX to CFC which returns HTML/HTML generated by cfm/XML or anything else , returns WDDX packet which gets decoded by wddx.js and rendered or populates js objects usually an array or object as in new Object() -> COOL stuff
      * Each window controls the look/function of one universal menu bar with the execption of say File/Help, much like Macintosh systems. This is as not to clutter up valuable space.
      * Footer; each time a window is created, a window tab button is created (much like the task bar in windows; dock in MacOS X). Clicking on one sets the associated div window to top most level -> index of windows is always updated on the onmousedown event of div.
      * All interaction through AJAX between client and server is encoded/decoded WDDX. So returing a record set or struct or string(which may be simple or as complex as a screen layout) is a snap!
      * ONLY problem with having this approch, HTML objects like iFrames need to have unique names as Iframes are bound to the document object and therefore you can not simple go

      eg. oDiv.all.oiFrame -> where oDiv is unique say 'oWindow_' + (new Date()).valueOf().

      So if rendering a template of a window, and you require an iframe, as was my case when using siteobjects (WYSIWYG) tool, I needed to have a hidden field hold the value of the iframe name/id.


      Anyways,

      I'm getting ahead of myself here... ALL i want is to be able to do something similar with flex, so that most of the code is Flex code. Also, can Flex be adapted to somehow function similar to SPECTRA with the intent to have a XML object oriented database system (OPTIMISED, unlike SPECTRA which was somewhat slow at times), this would enable developers only concentrate one unified system, and not have to worry about integrating third party db's with flex, and maybe allow the Flex engine to be coded from any language other then action script which I'm assuming is the scripting code behid it.

      Maybe allow C/C++/JAVA/ to link into it??? Probably this should go to another thread.

      Anyways, Hope you guys can help us out.

      Cheers
      Tibs
        • 1. Re: multi window flex application
          dishmael Level 1
          If I understand you correctly, you want to create a non-modal window. You may want to look into popUpManager.

          http://livedocs.macromedia.com/flex/2/docs/00000694.html
          • 2. Re: multi window flex application
            Josh Johnson Level 1
            One caveat is that the windows are constrained by the dimensions of the overall application, so it's not quite like Photoshop, but other than it should be able to support what you're looking for.
            • 3. Re: multi window flex application
              tibs75 Level 1
              close... but no cigar.

              Basically I'd like the windowing system to have a callback on closing/resizing.

              When an action is made to close it should IIF call its internal
              closing routine and only close the window if the provided callback return noErr


              eg.

              ..

              //Do Some prior checks


              // Do check on what type of confirmation it is

              // if three state -> use VBScript MessageBox

              // if Two state -> use JS confirm

              ...


              if(this.closeCallBackFn){
              noErr = this.closeCallBackFn(winPtr); // winPtr in this case is a reference to a div, that div has a reference to a js object which can to window/div manipulation; eg. winPtr._window.close()
              }

              if(noErr){
              // remove div from DOM; the div that was rendered
              // remove div from gARRAY_WINDOWS; an array of windows that we need to manage; also distroying the task bar visual; menu bar delacred menus for object
              }

              return (noErr);
              }



              Not sure if you guys understand what I'm trying to do.

              The application I had to write was as follows:


              - Many maintenance screens
              - js/cfm,html,xml templates/cfc/stored procs; each had to be a one to one to db tables
              - Because of point two above, each window as such would function differently, so the closing call back would call a respective js function for checking prior to closing;
              say I had two objects

              article.js -> tblArticle
              movies.js -> tblMovies

              Then when closing a window for both; remembering that these two windows could co-exist within the browser window; then closing say a article window would be closeCallBackFn = closeARTICLEWin(); whereas
              closing a movies window would be closeCallBackFn = closeMOVIEWin();

              - The windowing environment co-existed within one application; basically mimicing the desktop and each respective DB/JS object was in itself a window which controlled the menu bar, taskbar.
              - Swithing between layered divs achieved this so NO refresh was ever done within the browser window!
              - The windowLib.js contained the code to accommodate a variety of templates bound within its canvas area; therefore the resize,close,maximise,minimise had to be attended for when creating the window object; which obviously rendered the layered div with a specified template, it usually retreieved from an AJAX call, so the return response would be a HTML redered string. This string would then be rendered within the canvas area.



              Can this type of functionality be achieved with Flex?
              • 4. Re: multi window flex application
                Josh Johnson Level 1
                Maybe I'm not getting a nuance, but this seems to be pretty straightforward. Your "windowing system" is the main mxml application within Flex. Within that application, you can launch various classes of non-modal TitleWindows using the popUpManager. Then each class of TitleWindow would have a unique function called when it's close action is triggered.

                So you again would have a single application mimicing a desktop, and within that desktop you would have various windows (TitleWindows instead of layered divs), so again you'd never need to refresh the main window.

                Based on what you're stating, I'd say the answer is "Yes" this type of functionality can be achieved with Flex. And more so it's probably quite a bit easier than trying to dhtml into a windowing environment.