9 Replies Latest reply on Aug 25, 2010 1:11 PM by h_c

    window resizing issues

    h_c

      My application is built using Flex, Coldfusion  and MySQL as the back end. I am a newbie to Flex and come from a C/C++ development background.

       

      There is a window W1 which has a Vertical Box which in turn has a Datagrid  and one of those DataGrid columns of the Datagrid has a Horizontal Box  which has a button icon. The MXML is somewhat like

       

      <mx:VBox width="100%" paddingBottom="10" paddingLeft="10" paddingRight="10" paddingTop="10" styleName="formSection">
                  <mx:DataGrid id="my_grid" dataProvider="{my_grid_dp}" headerHeight="0" width="100%"
                       allowMultipleSelection="true" change="remove_value.enabled =  expected_result_grid.selectedItems.length > 0;" rowCount="3">
                      <mx:columns>
                           <mx:DataGridColumn headerText="Column 1" dataField="expected_result" wordWrap="true" />
                             
                          <mx:DataGridColumn headerText="Column 2" dataField="expected_result" width="45" >
                              <mx:itemRenderer>
                                  <mx:Component>
                                      <mx:HBox  horizontalAlign="center">
                                          <mx:Button icon="@Embed('../assets/img/edit.png')" toolTip="View" buttonMode="true" click="outerDocument.openmyWin_fn('update')"/>
                                      </mx:HBox>
                                  </mx:Component>
                              </mx:itemRenderer>
                           </mx:DataGridColumn>

       

                      </mx:columns>
                  </mx:DataGrid>
                 
              </mx:VBox>

       

      When the button icon is clicked(which is noted in bold above), another new window W2 is opened using the below function

       

      public function openmyWin_fn(eventObj:*):void
                  {
                      //Keeps multiple windows from being opened
                      if(result_win == null){
                          result_win = PopUpManager.createPopUp(this, result_win, true) as  result_win;
                      }

       

                      //Passes the parent object to the popup window
                      result_win.openingParentWindow = this;
                     
                      //Set the mode (Add or Update) in which the form should operate
                     result_win.form_mode = eventObj;
                     
                  }

       

      I  tried to add a TextInput control in the above MXML in Window W1's source which  led to the window W2 opening in the rightmost part of browser window  without a scroll bar instead of appearing with a scroll bar in the  center of browser window. W2 should be appearing as overlapping W1, not  adjacent to it on the right hand side.

       

      I commented the TextInput code I added but still window W2 was appearing as adjacent without scrollbars. I removed the code I added for the TextInput control, still the issue(window W2 opening in the rightmost part of browser  window without a scroll bar) persists.Window W2 was having scrollbars before I tried to add the TextInput MXML control. It was also centering in the browser window before I tried to add the TextInput MXML control.

       

      I once had this where  inadvertently a height value was added to the whole window W2 and W2 was opening in the rightmost part of browser  window without a scroll bar. After I  removed the height value from W2, the window was appearing in center with scroll bars. This time I am comparing the  source before I added the TextInput control and after I removed it and the files are identical.

       

      Where could I be erring to cause the W2 to appear in the rightmost part of browser? I guess the issue is not due to the change(TextInput control) I tried to add because no code exists for that attempted change now.

       

      I tried restarting my machine and all the services(Coldfusion, JRun, MySQL, IIS) and the problem persists. I have also compared the window W1's source file and it has nothing which could be causing the strange behavior of W2

       

      Am I missing some subtleties about Flex? How can an attempt to change which was undone cause such issues?

       

      Any suggestions would be appreciated.

        • 1. Re: window resizing issues
          betheflexcoder Level 2

          In your window opening function, you can control the position of the opening window by the something like the

          following code:

           

          result_win.x = give x position for your window

          result_win.y - give y position for your opening window

          1 person found this helpful
          • 2. Re: window resizing issues
            Flex harUI Adobe Employee

            Maybe refresh the HTML templates?

            1 person found this helpful
            • 3. Re: window resizing issues
              h_c Level 1

              Betheflexcoder,

               

              Thanks for the tip.

               

              But, what I am puzzled over is why this is happening. I tried to add a  MXML control. Window alignment went wrong due to it. I removed the  source I added for the MXML control so why doesn't the window alignment  return to normal?

              I guess the issue is not due to the change(TextInput  control) I tried to add because no code exists for that attempted  change now. Window W2 was having scrollbars before I tried to add the TextInput MXML  control. It was also centering in the browser window before I tried to  add the TextInput MXML control. I have also checked the window  W1's source file and it has nothing which could be causing this strange  behavior of W2.

               

              I  tried restarting my machine and all the associated services(Coldfusion, JRun,  MySQL, IIS), cleaned the project in Flex Builder, but the problem persists.

               

              How can an attempt to change(which was undone later) cause such issues?  Am I missing some subtleties about Flex?

               

               

              Thanks

              • 4. Re: window resizing issues
                h_c Level 1

                Flex harUI,

                 

                Thanks for the tip.

                 

                I did a right click on HTML template folder in Flexbuilder and did a refresh. But, it did not help. Do you refresh the HTML templates that way or is there some other method?

                 

                I am using Firefox browser 3.6, if it matters. I am manually clearing the cache after the browser closes.

                • 5. Re: window resizing issues
                  Flex harUI Adobe Employee

                  You might want to look at the template HTML to make sure it  has the correct

                  app size and check the app size from Flex as well.  Maybe the size is not

                  what you expect.

                  • 6. Re: window resizing issues
                    h_c Level 1

                    Thanks for the suggestion.

                     

                    How do I check the app size from HTML template and from Flex?

                    I went to Design view in Flexbuilder and the app(the MXML file in question) seems to be fine. Is that the correct method for checking app size in Flex?

                     

                    Sorry, if my question is naive, but I am a newbie.

                     

                    I did not change these things so can they change?

                     

                     

                    .

                    • 7. Re: window resizing issues
                      Flex harUI Adobe Employee

                      Sometimes I drop my mouse in the wrong place and something gets accidentally

                      edited.

                       

                      You can run code that traces out systemManager.stage.stageWidth/stageHeight

                      and see if matches what you have in your MXML.

                      • 8. Re: window resizing issues
                        h_c Level 1

                        Thanks for the tip.

                         

                        If something was accidentally edited in MXML, would the source code in the file change? I am new to Flex, so trying to understand if that could happen.

                         

                        Because when I compare the source files before I tried to add it and after the change was removed and they are identical.

                         

                        I deleted the entire source when the added change did not work and replaced it with its earlier contents(when it was working fine), but still the issue persists.

                         

                        I will run the code as you suggest. I just cannot understand why this is happening and what could be causing which is costing me lot of time.

                         

                        I appreciate your suggestions.

                        • 9. Re: window resizing issues
                          h_c Level 1

                          Thanks Flex harUI,


                          The issue was in the window which was causing the new pop up window to open.

                           

                          It had something like

                           

                          public function openWin_fn(eventObj:*):void
                                       {
                          ...................
                                              outcome_win = PopUpManager.createPopUp(this, my_new_win, true) as my_newlycreated_win;

                                         ...........................
                           
                                       }

                          At the line which is highlighted in bold, I needed a "parentWindowOpener" instead of a "this" pointer which was causing the issue. The line should be outcome_win = PopUpManager.createPopUp(parentWindowOpener, my_new_win, true) as my_newlycreated_win;

                          I don't recall why I changed the parentWindowOpener to this and am more surprised that my original source file had the "this" pointer which is why I could not trace it earlier.

                          Such subtleties of Flex are what I need to know in detail. Would you suggest any books for me? My background is mainly in C/C++ development.

                          Thanks for your help. I have marked your answer as correct so that you get the points since you tried to help me a lot and have given helpful answer to betheflexcoder for her response.