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

waitdialog cancel

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

    waitdialog cancel

    I am hoping to get a Cancel button working on my PleaseWait() dialog. Some time ago Selwyn suggested that quickdraw should solve this in v7. In testing with the following script I don't get consistent results, and I hope to move whatever technique works into my own dialog.

    First time after a reboot, run script, and press cancel button, the 'are you sure' msg box displays at the same time as the waitdialog - good. Subsequently they do not display at the same time, it may take multiple presses of the waitdialog Cancel button to display the 'are you sure', and the whole thing might require a ctl-alt-delete.

    is quickdraw my solution? don't find any info on that in webhelp.

    Bill.
    Code:
    colors = a5.Color_Enum()
    colors = replicate(colors,5)
    'dim x as waitdialogQD ' error 1 in v7
    'dim x as {waitdialogQD} ' error on x.create()
    dim x as {waitdialog}
    x.Create(3,"percent")
    x.AllowCancel(.t.)
    dim i as n 
    dim count as n 
    i = 0 
    count = line_count(colors)
    for each c in colors
    
        i = i + 1 
        x.set_percent(i,count)
        x.set_bottom_message(c.value)
        y = x.user_canceled()
        'if x.usercanceled then
        if y
            q = ui_msg_box("Notice","Are you sure?",UI_YES_NO_CANCEL) 
            if q = ui_yes_selected then 
                goto next2 
            else
                x.Cancel_Cancel()
            end if 
        end if 
    next 
    next2:
    x.close()
    Last edited by AaronBBrown; 10-17-2005, 10:47 AM.

    #2
    Bill,

    I'm not sure if you are talking about the new 'waitdialog' function or the PleaseWait function from the Code Archive. I also don't know if this will meet your requirements but here's what I've been doing since shortly after the original PleaseWait was posted. There is no 'close' button but clicking the red X to close it presents a dialog to help the user decide whether or not it should really be closed. (There have been a few changes along the way and I don't remember the original reason for the two regions that are now the same.) Without this capability, I would not be using this function.

    Code:
    FUNCTION PleaseWait_fnc as C ( Show=.F. as L, info_msg="" as C )
     'Description:Shows "Please Wait" Xdialog with optional sub-message.  Run function with Show=.T. to show the message. Use no arguments (or .F.) to turn off the message.
     DIM box_code as C
     DIM box_event as C
     DIM close_result as C
     DIM mlen as N
     DIM PleaseWait as C
     DIM wait_txt as C
     DIM show as L
     DIM info_msg as C
     PleaseWait = "" 'Just so it can return something.
     IF show = .F.
      IF ui_modeless_dlg_exist( "Processing" )
       ui_modeless_dlg_close( "Processing" )
      END IF
      EXIT FUNCTION
     END IF
     info_msg = alltrim( info_msg )
     mlen = len( info_msg )
     'Skip the first line if the message is shorter than 28 characters.
     IF mlen < 28
      'If less than 28, we will use a fixed font to center the text.
      info_msg = crlf() + space( ( 28 - mlen ) / 2 ) + info_msg
     ELSEIF mlen < 4500
      info_msg = crlf() + info_msg
     END IF
     wait_txt = "Please Wait"
     dlg_text = <<%dlg%
    {can_exit=closeit}
    {background=Dirty White}
    {font=Arial,16,bi}
    {sp=9}{text=35,2:wait_txt};
    {line=1,0};
    {condition=(mlen<28)}
    {region}
    {font=Courier,10,n}{text=45,4:Info_msg};
    {endregion}
    {condition=(mlen>=28)}
    {start_pos}
    {region}
    {font=Courier,10,n}{text=45,4:Info_msg};
    {endregion};
    %dlg%
     box_event = <<%code%
    IF a_dlg_button = "Closeit"
     close_result = Close_warning()
     IF close_result = "Yes"
      ui_modeless_dlg_close( "Processing" )
     END IF
    END IF
    %code%
     ui_modeless_dlg_box( "Processing", dlg_text, box_event )
     ui_modeless_dlg_setfocus( "Processing" )
     ui_modeless_dlg_refresh( "Processing" )
    END FUNCTION
    '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
    '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
    FUNCTION Close_warning as C()
     DIM Close_warning as C
     DIM msg as C
     DIM msg1 as C
     DIM msg2 as C
     DIM msg3 as C
     DIM hdr1 as C
     DIM hdr2 as C
     msg = "You have attempted to close the 'Please Wait' message manually. This should not be done unless "
     msg = msg + "the program has stopped running"
     hdr1 = msg
     msg = "PLEASE VERIFY THAT THE PROGRAM HAS STOPPED BY CHECKING THE FOLLOWING"
     hdr2 = msg
     msg = "The status bar at the lower left corner of the database window has stopped changing"
     msg1 = msg
     msg = "The hard drive light has gone off and/or any writes to the hard drive should have "
     msg = msg + "been finished long ago"
     msg2 = msg
     msg = "ARE YOU SURE YOU WANT TO CLOSE THIS 'Please Wait' MESSAGE"
     msg3 = msg
     DIM dlg_result as C
     dlg_text = <<%dlg%
    {ysize=.3}{units=F}{font=Time New Roman,9,n}{sp};
    {text=105,2:hdr1};{sp};
    {font=Time New Roman,9,b}{text=90,1:hdr2}{font=Time New Roman,9,n};{sp};
    {region}
      - |{text=100,1:msg1};
      - |{text=100,1:msg2};
    {endregion};{sp};
    {justify=center}{font=Time New Roman,9,b}{text=69,2:msg3}{font=Time New Roman,9,n};
    {justify=center}<*15Yes> <15No>
    %dlg%
    
     DIM dlg_result as C
     dlg_result = ui_dlg_box( "*** WARNING ***", dlg_text, <<%code%
    %code% )
     Close_warning = dlg_result
    END FUNCTION 'Close-warning
    Bummer - I see the message board is changing double quotes to the HTML tag for a quote. I tried to edit them but if it doesn't work, I guess you'll have to change them back yourself.

    Cal Locklin
    www.aimsdc.net
    Last edited by CALocklin; 10-13-2005, 05:21 PM.

    Comment


      #3
      Cal,

      The first code I posted was a bit misleading since I am just trying to get something to work. I also allow closing my please_wait by clicking the X. My problem is being able to stop another running process. This started when I wanted to be able to interrupt my bulk email script after only part of the emails had been sent. I wanted to set a global variable, p_pleasewait_cancel, that a running script could check to see if it should terminate.

      Below is my pleasewait function. p_pleasewait_cancel does not get set until the calling script finishes. Selwyn explained why to me once, but I forget the details.

      Bill.

      Code:
      FUNCTION p_PleaseWait AS V (Show=.t., Msg="", Justify="center", AllowCancel=.f., MinWidth=50)
      'DESCRIPTION:Show (def.=.t.) .f. to close, Msg (def.="") crlf() string to display, AllowCancel (def.=.f.) sets p_PleaseWait_cancel (global var.), MinWidth (def.=50).
      '	font size used on StatusBar is 10, so that is used here.  dlg default is 8.
      '	Parameter options:
      '	  Justify - left, center. would use left if rapidly showing consecutive values.
      '	  AllowCancel - does not work.  Selwyn talked about new approach.
      '	03-04-05 add AllowCancel, Justify, MinWidth parameters.
      
      IF AllowCancel
      	DIM Global p_PleaseWait_cancel as L
      	if .not.eval_valid("p_PleaseWait_cancel_set")
      		p_PleaseWait_cancel = .f.
      	end if
      	DIM Global p_PleaseWait_cancel_set as L	' so p_PleaseWait_cancel is only set on first call.
      	p_PleaseWait_cancel_set = .t.
      END IF
      
      '	***** Close the dlg box ******************************************************************
      if show = .F.
      	if ui_modeless_dlg_exist("Processing")
      		ui_modeless_dlg_close("Processing")
      	end if 
      	delete p_PleaseWait_cancel
      	delete p_PleaseWait_cancel_set
      	exit function
      end if
      
      '	***** Define parts of the box format code ************************************************
      vText = stritran(Msg,crlf(), ";" +crlf())
      
      vPleaseWait = "Please Wait"
      vLen = len(vPleaseWait)
      vPleaseWait = space(MinWidth/2 -vLen/2) +vPleaseWait +space(MinWidth/2 -vLen/2)
      
      vDlg_format = <<%dlg%
      {can_exit=Exit}
      {font=arial,10,b}
      {justify=center}
      {text=minwidthvPleaseWait};
      {font=arial,10}
      {justify=left}
      _line_
      {justify=_justify_}
      Text_Msg;
      _cancel_code_
      %dlg%
      
      '{line=1};
      vCancel_format = <<%dlg%
      {condition=(allowcancel=.t.)}
      {justify=left}
      
      {region=a}
      {justify=center}
      <*Cancel!cancel>
      {endregion};
      %dlg%
      
      vDlg_event = <<%code%
      IF a_dlg_button = "exit"	' helpful if dislog is hung open, press X
      	ui_modeless_dlg_close("Processing")
      	delete p_PleaseWait_cancel
      	delete p_PleaseWait_cancel_set
      END IF
      IF a_dlg_button = "cancel"
      	xbasic_wait_for_idle()	' does not seem to help w/ processing of cancel button
      	p_PleaseWait_cancel = .t.	' set global variable
      '	debug(1) this shows that cancel from p_email_client is not processed until after all emails are sent.
      END IF
      %code%
      
      '	***** Build the desired box format code ******************************************************
      vDlg_format = stritran(vDlg_format, "Text_Msg", vText)
      vDlg_format = stritran(vDlg_format, "minwidth", alltrim(str(MinWidth)))
      
      IF Justify = "center"
      	vDlg_format = stritran(vDlg_format, "_justify_", "center")
      ELSE
      	vDlg_format = stritran(vDlg_format, "_justify_", "left")
      END IF
      
      IF msg = ""
      	vDlg_format = stritran(vDlg_format, "_line_", "")
      ELSE
      	vDlg_format = stritran(vDlg_format, "_line_", "{line=1};")
      END IF
      
      if AllowCancel
      	vDlg_format = stritran(vDlg_format, "_cancel_code_", vCancel_format)
      else
      	vDlg_format = stritran(vDlg_format, "_cancel_code_", "")
      end if
      
      '	***** Show the dlg box ***********************************************************************
      ui_modeless_dlg_box("Processing",vDlg_format,vDlg_event)
      ui_modeless_dlg_setfocus("Processing")
      ui_modeless_dlg_refresh("Processing")
      
      END FUNCTION

      Comment


        #4
        this is fixed in the next beta. it will always respond on the first click now.

        the waitdialogQD class in V6 (which was for internal use only, and was never documented), no longer exists in V7.

        the waitdialog class in V7 has been rewritten and now internally uses the same logic that the waitdialogQD class in v6 uses.

        Comment


          #5
          Selwyn, are there techniques that I could use in my own please_wait function so a running script can detect if a modeless dialog button is pushed. I wanted to add formatting control for centering or left justifying text, and a few other things.

          Bill.

          Comment


            #6
            the technique that you would use would be to use the

            ui_modeless_dlg_button() command in the running script. This command will let you test if the user has pressed a button in the 'wait dialog'.\

            you might also want to use the ui_yield() function in looping script to give a5 time to 'breathe'.

            Comment


              #7
              I had looked at ui_modeless_dlg_button() before, but since the example used it in a {watch} expression and I am calling from xbasic script, I lost the forest for the trees.

              ui_yeild() seems to be the key for me. but I did find an issue with mouse clicking the button, and one with ui...button().

              --- add ui_yeild() as first line in my please_wait function
              calling script sees my global variable with [enter] but not mouse click.
              ui...button() in calling script does not trap either [enter] or mouse click

              --- add ui_yeild() to loop in calling script.
              calling script sees my global variable with [enter] but not mouse click.
              ui...button() in calling script traps [enter] to press button, but not mouse click.

              there is nothing on ui_yeild() in the web help yet.

              Bill.

              Comment

              Working...
              X