Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

Calling a Modeless XDialog within a Modal XDialog

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Calling a Modeless XDialog within a Modal XDialog

    Greetings,

    I'm sure this can be done, I think the example with the "{Close_On_Leave}" is trying to demonstrate this although I have not gotten all the pieces clear as to how this really works.

    In the example below I have the base script, with three fields. The 2nd script is a "modeless" XDialog script. When the user is in Field 2, I want the "modeless" dialog to appear and when they are no longer in Field 2, I want it to close on its own. If the user wishes to close it while they are in Field 2, the Close button should take care of that.

    How do I go about doing this?

    Base Script
    Code:
    DIM SHARED Fld1 as C
    DIM SHARED Fld2 as C
    DIM SHARED Fld3 as C
    DIM SHARED varC_result as C
    heading_string = "Call Modeless XDialog while in Field2"
    footer_string = "Close if not in Field 2"
    ok_button_label = "&OK"
    cancel_button_label = "&Cancel"
    varC_result = ui_dlg_box("XDialog Example",<<%dlg%
    {region}
    {text=55,1:heading_string};
    {endregion};
    {region}
    Data Field 1:| [.40Fld1];
    Data Field 2:| [.40Fld2];
    Data Field 3:| [.40Fld3];
    {endregion};
    {region}
    {text=55,1:footer_string};
    {endregion};
    {line=1,0};
    {region}
    <*15=ok_button_label!OK> <15=cancel_button_label!CANCEL>
    {endregion};
    %dlg%)
    Modeless Script
    Code:
    DIM StatText as C
    StatText = "This is the static text to be replaced"
    ui_modeless_dlg_box("Modeless Dlg",<<%dlg%
    {region}
    {Region}
    ;
    {Endregion};
    {Region}
    | {text=80,10:StatText};
    {Endregion}; 
    {Region}
    ;
    {Endregion};
    {line=1,0};
    <15Close>;
    {endregion};
    %dlg%,<<%code%
    if a_dlg_button = "Close"  then
        ui_modeless_dlg_close("Modeless Dlg")
    end if
    %code%)
    Regards,
    Keith
    Keith Weatherhead
    Discus Data, Ltd
    [email protected]

    #2
    Re: Calling a Modeless XDialog within a Modal XDialog

    Here the modeless xdialog will pop up if you attempt to make an entry in fld2.

    Code:
    DIM SHARED Fld1 as C
    DIM SHARED Fld2 as C
    DIM SHARED Fld3 as C
    DIM SHARED varC_result as C
    heading_string = "Call Modeless XDialog while in Field2"
    footer_string = "Close if not in Field 2"
    ok_button_label = "&OK"
    cancel_button_label = "&Cancel"
    dlg_code=<<%dlg%
    {region}
    {text=55,1:heading_string};
    {endregion};
    {region}
    Data Field 1:| [.40Fld1];
    Data Field 2:| [.40Fld2!fld2_*];
    Data Field 3:| [.40Fld3];
    {endregion};
    {region}
    {text=55,1:footer_string};
    {endregion};
    {line=1,0};
    {region}
    <*15=ok_button_label!OK> <15=cancel_button_label!CANCEL>
    {endregion};
    %dlg%
    
    event_code=<<%code%
    select
    	case left(a_dlg_button,4) = "fld2"
    	if a_dlg_button = "fld2_change" then
    	   a_dlg_button = ""
    		RunModelessXD()
    		elseif a_dlg_button = "fld2_setfocus" then
    			a_dlg_button = ""
    			   if ui_modeless_dlg_exist("Modeless Dlg")
    				ui_modeless_dlg_close("Modeless Dlg")
    			   end if
    				else
    					a_dlg_button = ""
    	end if
    end select
    %code%
    
    varC_result = ui_dlg_box("XDialog Example",dlg_code,event_code)
    
    Function RunModelessXD as V()
    DIM StatText as C
    StatText = "This is the static text to be replaced"
    dlg_code=<<%dlg%
    {region}
    {Region}
    ;
    {Endregion};
    {Region}
    | {text=80,10:StatText};
    {Endregion}; 
    {Region}
    ;
    {Endregion};
    {line=1,0};
    <15Close>;
    {endregion};
    %dlg%
    
    event_code=<<%code%
    if a_dlg_button = "Close"  then
        ui_modeless_dlg_close("Modeless Dlg")
    end if
    %code%
    
    ui_modeless_dlg_box("Modeless Dlg",dlg_code,event_code)
    End Function
    This may give you some ideas.
    Finian

    Comment


      #3
      Re: Calling a Modeless XDialog within a Modal XDialog

      Here is some code. I didn't do the closing of the modeless dlg.
      I am assuming that the name of the modeless dlg script is "test2"

      Code:
      DIM SHARED Fld1 as C
      DIM SHARED Fld2 as C
      DIM SHARED Fld3 as C
      DIM SHARED varC_result as C
      heading_string = "Call Modeless XDialog while in Field2"
      footer_string = "Close if not in Field 2"
      ok_button_label = "&OK"
      cancel_button_label = "&Cancel"
      varC_result = ui_dlg_box("XDialog Example",<<%dlg%
      {region}
      {text=55,1:heading_string};
      {endregion};
      {region}
      Data Field 1:| [.40Fld1];
      Data Field 2:| [.40Fld2!field2_*];
      Data Field 3:| [.40Fld3];
      {endregion};
      {region}
      {text=55,1:footer_string};
      {endregion};
      {line=1,0};
      {region}
      <*15=ok_button_label!OK> <15=cancel_button_label!CANCEL>
      {endregion};
      %dlg%,<<%code%
      select
          case a_dlg_button="field2_setfocus"
           a_dlg_button=""
            script_play_local("test2")
           
            
          case a_dlg_button="CANCEL"
            a_dlg_button="Close"  
          
          case else
            a_dlg_button=""  
            
          
            
      end select
      %code%)
      The Mexican

      Comment


        #4
        Re: Calling a Modeless XDialog within a Modal XDialog

        Oops, the line
        elseif a_dlg_button = "fld2_setfocus" then
        should be
        elseif a_dlg_button = "fld2_killfocus" then

        to close the xdialog on leaving the fld2 field.
        Finian

        Comment


          #5
          Re: Calling a Modeless XDialog within a Modal XDialog

          Originally posted by Mario Prieto
          Here is some code. I didn't do the closing of the modeless dlg.
          I am assuming that the name of the modeless dlg script is "test2"

          Mario, I appreciate the assistance. When I tried your example code, I could not get the second window (modeless) to open at any field. Not sure if there is something set wrong on my system... does it work on yours?

          Regards,
          Keith
          Keith Weatherhead
          Discus Data, Ltd
          [email protected]

          Comment


            #6
            Re: Calling a Modeless XDialog within a Modal XDialog

            Originally posted by Finian Lennon
            Here the modeless xdialog will pop up if you attempt to make an entry in fld2.

            This may give you some ideas.

            Thanx, Finian, its very close to what I need to start with. I made the "set" to "kill" _focus change you outlined in the other post.

            There are two issues with this code and most likely it has to do with my initial explanation....

            1st, I want the window to open as soon as the user "arrives" at the 2nd field. This window is suppose to have some specific instructions about the 2nd field so I would like it visable before anything is typed into the field.

            2nd, the modeless window keeps popping up over the main window with every character you try to type into the 2nd field, rather than opening once, it attempts to open on every keypress. Is this a big change?

            I like the indented code in the XDialog !! I've never really seen any examples of indented XDialog and it certainly makes it a bit easier to decypher what the components are that way.

            Regards,
            Keith
            Keith Weatherhead
            Discus Data, Ltd
            [email protected]

            Comment


              #7
              Re: Calling a Modeless XDialog within a Modal XDialog

              Just sticking my head in here so I will get notified of further replies so I can follow this thread.
              My two cents worth :)

              Oran

              Comment


                #8
                Re: Calling a Modeless XDialog within a Modal XDialog

                Originally posted by masteralone
                Just sticking my head in here so I will get notified of further replies so I can follow this thread.
                Welcome aboard !!
                I'm playing with it and *if* I get it before one of our asteemed masters, "shows us the way", I'll post it, so far I'm taking more lumps than getting it to do what I want.

                Keith
                Keith Weatherhead
                Discus Data, Ltd
                [email protected]

                Comment


                  #9
                  I finally got to a working example ! ! !

                  Originally posted by KeithW
                  Welcome aboard !!
                  I'm playing with it and *if* I get it before one of our asteemed masters, "shows us the way", I'll post it, so far I'm taking more lumps than getting it to do what I want.

                  Keith
                  Thanx to those that offered ideas to me on this issue, I am still way behind the eight-ball when it comes to XDialog, but it is beginning to make some sense and I have begun to make some forward progress again...

                  As I promised... here is a working version, based off of finian's changes to my original example code posted. I'm sure it can be further revised to provide the same functionality, yet done in fewer commands.

                  I was just interested in getting it to function period, now the revisions can come... but the functionality that I originally was looking for is there. The "modeless" dialog opens when going into field_2 and when going into either of the other fields will close that "modeless" dialog.

                  In my application I am adding a button to open the dialog regardless of which field your in now that I found the ui_dlg_ctl_goto() function as that was the "other" functionality I was looking for, but had not yet discovered in my searching.

                  Hope this saves some else the intial hassle of trying to do something like this.

                  Code:
                  DIM SHARED Fld1 as C
                  DIM SHARED Fld2 as C
                  DIM SHARED Fld3 as C
                  DIM SHARED varC_result as C
                  DIM SHARED ModeLessExist as L
                  ModeLessExist = .f.
                  heading_string = "Call Modeless XDialog while in Field2"
                  footer_string = "Close if not in Field 2"
                  ok_button_label = "&OK"
                  cancel_button_label = "&Cancel"
                  dlg_code=<<%dlg%
                  {region}
                  {text=55,1:heading_string};
                  {endregion};
                  {region}
                  Data Field 1:| [.40Fld1!Fld1_*];
                  Data Field 2:| [.40Fld2!fld2_*];
                  Data Field 3:| [.40Fld3!Fld3_*];
                  {endregion};
                  {region}
                  {text=55,1:footer_string};
                  {endregion};
                  {line=1,0};
                  {region}
                  <*15=ok_button_label!OK> <15=cancel_button_label!CANCEL>
                  {endregion};
                  %dlg%						'end of Format string
                  event_code=<<%code%
                  select
                  	case left(a_dlg_button,4) = "fld2"
                  		if a_dlg_button = "fld2_SetFocus"  .AND.  ModeLessExist = .f.  then
                  		   a_dlg_button = ""
                  			RunModelessXD()
                  			if ui_modeless_dlg_exist("Modeless Dlg")
                  				ModeLessExist = .t.
                  			else
                  				ModeLessExist = .f.
                  			end if
                  			
                  		else
                  			a_dlg_button = ""
                  	end if
                  
                  	case left(a_dlg_button,4) = "fld1"
                  		if a_dlg_button = "fld1_SetFocus" then
                  			a_dlg_button = ""
                  			if ui_modeless_dlg_exist("Modeless Dlg")
                  				ui_modeless_dlg_close("Modeless Dlg")
                  				ModeLessExist = .f.
                  			else
                  				ModeLessExist = .f.
                  			end if
                  		else
                  			a_dlg_button = ""
                  	end if
                  
                  	case left(a_dlg_button,4) = "fld3"
                  		if a_dlg_button = "fld3_SetFocus" then
                  			a_dlg_button = ""
                  			if ui_modeless_dlg_exist("Modeless Dlg")
                  				ui_modeless_dlg_close("Modeless Dlg")
                  				ModeLessExist = .f.
                  			else
                  				ModeLessExist = .f.
                  			end if
                  		else
                  			a_dlg_button = ""
                  	end if
                  
                  end select
                  %code%						'end of Event string
                  '--------------------------------------------------------------
                  varC_result = ui_dlg_box("XDialog Example",dlg_code,event_code)
                  END
                  '----------------------------
                  Function RunModelessXD as V()                                  'function wrapping modeless dialog
                  DIM StatText as C
                  StatText = "This is the static text to be replaced"
                  dlg_code=<<%dlg%
                  {region}
                  {Region}
                  ;
                  {Endregion};
                  {Region}
                  | {text=80,10:StatText};
                  {Endregion}; 
                  {Region}
                  ;
                  {Endregion};
                  {line=1,0};
                  <15Close>;
                  {endregion};
                  %dlg%						'end of Format string
                  event_code=<<%code%
                  if a_dlg_button = "Close"  then
                      ui_modeless_dlg_close("Modeless Dlg")
                  end if
                  %code%						'end of Event string
                  ui_modeless_dlg_box("Modeless Dlg",dlg_code,event_code)
                  End Function
                  Regards,
                  Keith
                  Last edited by KeithW; 07-16-2006, 10:20 PM. Reason: Change title...
                  Keith Weatherhead
                  Discus Data, Ltd
                  [email protected]

                  Comment

                  Working...
                  X