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

Dialog box - change default variable value based on selection

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

    Dialog box - change default variable value based on selection

    I have a dialog box with these variables
    v_stmt_type - this is a list of the types of statements that the company will run
    V_stmt_days - the default is set to 0 and is used in the aging of accounts receivable and statement runs.

    What I need is for the variable v_stmt_days to change to 45 when the user selects "Management Company Statements" in the v_stmt_type.
    See the attached image for a better explanation.

    So the question, how do I code the dialog box to do this?

    Thanks
    Mike Reed
    Phoenix, AZ

    #2
    Re: Dialog box - change default variable value based on selection

    Xdialog is still pretty much voodoo to me but...

    IF a_dlg_button = "v_stmt_type_change"
    IF v_stmt_type = "Management Company Statement"
    v_stmt_days = 45
    END IF
    END If

    Post your dialog box code so we can see specifically.

    Comment


      #3
      Re: Dialog box - change default variable value based on selection

      Here is the code. What you wrote in your post makes sense, I don't how and where to place it.


      DELETE a_v_stmt_type
      DIM a_v_stmt_type[4] as c
      dim temp_list as c
      temp_list = <<%list%
      All Complex Statements
      Complex Statement - Select
      Lien Statement
      Management Company Statement
      %list%

      a_v_stmt_type.initialize(temp_list)
      ' this next line would have to have some static data in it to run properly, since you don't have the 'accounts' table.
      auto_list_v_stmt_cmplx = table.external_record_content_get("accounts","padr(Complex,70,\" \") + \" | \" + comid","complex","balance > 0 .and. unique_key_value()")

      temp_count = w_count(auto_list_v_stmt_cmplx,crlf())
      DELETE a_v_stmt_cmplx
      DIM a_v_stmt_cmplx[temp_count] as c
      a_v_stmt_cmplx.initialize(auto_list_v_stmt_cmplx)
      heading_string = "Make your selections below"
      footer_string = "Click 'OK' to continue or 'Cancel' to quit"
      ok_button_label = "&OK"
      cancel_button_label = "&Cancel"
      varC_result = ui_dlg_box("STATEMENT PREPARATION",<<%dlg%
      {region}
      {text=65,1:heading_string};
      {endregion};
      {region}
      Statement Type:| [.40,4v_stmt_type^#a_v_stmt_type];
      {condition_begin=v_stmt_type = "All Complex Statements"}
      Print Complexes Marked to Exclude:| (40vexclude);
      {condition_end}
      {condition_begin=v_stmt_type <> "Lien Statement" }
      Print Statements Only:| (40v_stmt_print);
      List Paid Amount:| (40v_stmt_paid);
      {condition_begin=v_stmt_paid}
      Beginning Date Paid:| [%DATE;P=popup.calendar(dtoc(vbeg));I=popup.calendar%.20vbeg!vbeg_*];
      Ending Date Paid:| [%DATE;P=popup.calendar(dtoc(vend));I=popup.calendar%.20vend!vend_*];
      {condition_end}
      Days Due \(0 for all):| [%z%.3v_stmt_days];
      {condition_begin=v_stmt_print = .f.}
      Return Email Address:| [.50v_stmt_rtn];
      Blind Carbon Copy Email Address:| [.50v_stmt_bcc];
      Email/Fax Message:| [%mw%.40,5v_stmt_msg];
      {condition_end}
      {condition_end}
      {condition_begin=(v_stmt_type="Complex Statement - Select" .and. v_stmt_days = 0 ).or. v_stmt_type = "Lien Statement" }
      Select Complex\(s):| [%M;d;O={@@}%.50,15v_stmt_cmplx^#a_v_stmt_cmplx];
      {condition_end}
      {endregion};
      {region}
      {text=65,1:footer_string};
      {endregion};
      {line=1,0};
      {region}
      <*15=ok_button_label!OK> <15=cancel_button_label!CANCEL>
      {endregion};
      %dlg%)
      Mike Reed
      Phoenix, AZ

      Comment


        #4
        Re: Dialog box - change default variable value based on selection

        You wouldn't need to change much...

        Here's the full code... then I'll explain the changes...

        Code:
        DELETE a_v_stmt_type 
        DIM a_v_stmt_type[4] as c
        dim temp_list as c 
        temp_list = <<%list%
        All Complex Statements
        Complex Statement - Select
        Lien Statement
        Management Company Statement
        %list%
        
        a_v_stmt_type.initialize(temp_list)
        ' this next line would have to have some static data in it to run properly, since you don't have the 'accounts' table.
        auto_list_v_stmt_cmplx = table.external_record_content_get("accounts","padr(Complex,70,\" \") + \" | \" + comid","complex","balance > 0 .and. unique_key_value()")
        
        temp_count = w_count(auto_list_v_stmt_cmplx,crlf())
        DELETE a_v_stmt_cmplx
        DIM a_v_stmt_cmplx[temp_count] as c
        a_v_stmt_cmplx.initialize(auto_list_v_stmt_cmplx)
        heading_string = "Make your selections below"
        footer_string = "Click 'OK' to continue or 'Cancel' to quit"
        ok_button_label = "&OK"
        cancel_button_label = "&Cancel"
        varC_result = ui_dlg_box("STATEMENT PREPARATION",<<%dlg%
        {region}
        {text=65,1:heading_string};
        {endregion};
        {region}
        Statement Type:| [.40,4v_stmt_type^#a_v_stmt_type!tc_*];
        {condition_begin=v_stmt_type = "All Complex Statements"}
        Print Complexes Marked to Exclude:| (40vexclude);
        {condition_end}
        {condition_begin=v_stmt_type <> "Lien Statement" }
        Print Statements Only:| (40v_stmt_print);
        List Paid Amount:| (40v_stmt_paid);
        {condition_begin=v_stmt_paid}
        Beginning Date Paid:| [%DATE;P=popup.calendar(dtoc(vbeg));I=popup.calendar%.20vbeg!vbeg_*];
        Ending Date Paid:| [%DATE;P=popup.calendar(dtoc(vend));I=popup.calendar%.20vend!vend_*];
        {condition_end}
        Days Due \(0 for all):| [%z%.3v_stmt_days];
        {condition_begin=v_stmt_print = .f.}
        Return Email Address:| [.50v_stmt_rtn];
        Blind Carbon Copy Email Address:| [.50v_stmt_bcc];
        Email/Fax Message:| [%mw%.40,5v_stmt_msg];
        {condition_end}
        {condition_end}
        {condition_begin=(v_stmt_type="Complex Statement - Select" .and. v_stmt_days = 0 ).or. v_stmt_type = "Lien Statement" }
        Select Complex\(s):| [%M;d;O={@@}%.50,15v_stmt_cmplx^#a_v_stmt_cmplx];
        {condition_end}
        {endregion};
        {region}
        {text=65,1:footer_string};
        {endregion};
        {line=1,0};
        {region}
        <*15=ok_button_label!OK> <15=cancel_button_label!CANCEL>
        {endregion};
        %dlg%,<<%code%
        IF a_dlg_button = "tc_change"
        	If v_stmt_type = "Management Company Statement"
        		v_stmt_days = 45
        	Else
        		v_stmt_days = 0
        	end if
        end if
        a_dlg_button = ""
        %code%)
        On the line...

        Statement Type:| [.40,4v_stmt_type^#a_v_stmt_type!tc_*];

        I added !tc_* to the end of the variable to capture the events.

        And then at the end, after %dlg% remove the paren and add

        ,<<%code% and the rest as you can see.

        Comment


          #5
          Re: Dialog box - change default variable value based on selection

          Thanks for your help. Capturing the event, was a part I missed.

          One small issue remains. I copy the code over and now the OK and Cancel buttons won't respond, the only way of the dialog box is the Red X.

          Thanks again,
          mike
          Mike Reed
          Phoenix, AZ

          Comment


            #6
            Re: Dialog box - change default variable value based on selection

            Put this code in after the check for the selection...

            Code:
            If a_dlg_button = "OK"
            	ui_modeless_dlg_close("STATEMENT PREPARATION")
            end if
            If a_dlg_button = "CANCEL"
            	ui_modeless_dlg_close("STATEMENT PREPARATION")	
            end if	
            a_dlg_button = ""
            You have to move the a_dlg_button = "" code.

            This forces the dialog to stay open so you can click away inside the dialog.

            Comment


              #7
              Re: Dialog box - change default variable value based on selection

              David,
              Thanks again!

              It works great. I don't know much about the Xdialog stuff, so this is a good learning tool for me.

              Now to get it my notes, so can remember how to use it again. :)

              I appreciate your help.

              mike
              Mike Reed
              Phoenix, AZ

              Comment


                #8
                Re: Dialog box - change default variable value based on selection

                I don't either... I can cobble together some changes based on existing code... but to build an xdialog... yikes... and as soon as I've done something in xdialog... I forget it.

                Comment


                  #9
                  Re: Dialog box - change default variable value based on selection

                  Mike:
                  here is another version
                  'Date Created: 21-Sep-2010 12:00:41 PM
                  'Last Updated: 21-Sep-2010 01:49:06 PM
                  'Created By : E009933
                  'Updated By : E009933
                  trace.clear()
                  DELETE a_v_stmt_type
                  DIM a_v_stmt_type[4] as c
                  dim temp_list as c
                  dim global vdat1 as D
                  dim global vbeg as D
                  dim global vend as D
                  dim global v_stmt_days AS N
                  dim lv as p
                  lv = local_variables()

                  vdat1=date()
                  vbeg=date()
                  vend=date()
                  v_stmt_days = 0
                  temp_list = <<%list%
                  All Complex Statements
                  Complex Statement - Select
                  Lien Statement
                  Management Company Statement
                  %list%

                  a_v_stmt_type.initialize(temp_list)
                  ' this next line would have to have some static data in it to run properly, since you don't have the 'accounts' table.
                  auto_list_v_stmt_cmplx = table.external_record_content_get("accounts","padr(Complex,70,\" \") + \" | \" + comid","complex","balance > 0 .and. unique_key_value()")

                  temp_count = w_count(auto_list_v_stmt_cmplx,crlf())
                  DELETE a_v_stmt_cmplx
                  DIM a_v_stmt_cmplx[temp_count] as c
                  a_v_stmt_cmplx.initialize(auto_list_v_stmt_cmplx)


                  heading_string = "Make your selections below"
                  footer_string = "Click 'OK' to continue or 'Cancel' to quit"
                  ok_button_label = "&OK"
                  cancel_button_label = "&Cancel"
                  Delete XdialogStyle
                  dim XDialogStyle as p
                  XDialogStyle.AccentColor = "White"
                  XDialogStyle.Color = "#153+204+255"

                  dlg_title=""
                  dlg_title="STATEMENT PREPARATION"
                  varC_result = ui_modeless_dlg_box(dlg_title,<<%dlg%
                  ;
                  {on_key=enter}
                  Press Enter to advance to next field. When focus is on OK button, Enter will close the dialog;
                  {lf};
                  {watch=v_stmt_type!v_stmt_type_changed_*}
                  {Windowstyle=Gradient Horizontal Bottom}
                  {region}
                  {text=65,1:heading_string};
                  {endregion};
                  {region}
                  Statement Type:|[.40,4v_stmt_type ^#a_v_stmt_type !v_stmt_type_changed_*];
                  {condition_begin=v_stmt_type = "All Complex Statements"}

                  Print Complexes Marked to Exclude:| (40vexclude);
                  {condition_end}
                  {condition_begin=v_stmt_type <> "Lien Statement" }
                  Print Statements Only:| (40v_stmt_print);
                  List Paid Amount:| (40v_stmt_paid);
                  {condition_begin=v_stmt_paid}
                  Beginning Date Paid:| [%DATE;P=popup.calendar(dtoc(vbeg));I=popup.calendar%.20vbeg];
                  Ending Date Paid:| [%DATE;P=popup.calendar(dtoc(vend));I=popup.calendar%.20vend];

                  {condition_end}
                  Days Due \(0 for all):| [%z%.3v_stmt_days];
                  {condition_begin=v_stmt_print = .f.}
                  Return Email Address:| [.50v_stmt_rtn];
                  Blind Carbon Copy Email Address:| [.50v_stmt_bcc];
                  Email/Fax Message:| [%mw%.40,5v_stmt_msg];
                  {condition_end}
                  {condition_end}
                  {condition_begin=(v_stmt_type="Complex Statement - Select" .and. v_stmt_days = 0 ).or. v_stmt_type = "Lien Statement" }
                  Select Complex\(s):| [%M;d;O={@@}%.50,15v_stmt_cmplx^#a_v_stmt_cmplx];
                  {condition_end}
                  {endregion};
                  {region}
                  {text=65,1:footer_string};
                  {endregion};
                  {line=1,0};
                  {region}
                  {endregion};
                  {lf};
                  <15=ok_button_label!OK> <15=cancel_button_label!CANCEL>

                  %dlg%, <<%code%
                  if a_dlg_button = "OK" then
                  ' exit
                  end if

                  if a_dlg_button = "OK" then
                  a_dlg_button = ""
                  ui_msg_box("OK Button Pushed","OK Button Pushed")
                  ui_modeless_dlg_close(dlg_title)
                  end if

                  if a_dlg_button = "enter" then
                  if atc("!ok",ui_dlg_ctl_current(dlg_title)) > 0 then
                  'user is on the OK button, so close the dialog
                  else
                  'user is not on the OK button, so advance to next control
                  ui_dlg_navigate(dlg_title,"Next")
                  'set a_dlg_button to null to keep the dialog open
                  a_dlg_button = ""
                  end if
                  end if

                  if a_dlg_button = "v_stmt_type_changed_*" then
                  if v_stmt_type= "All Complex Statements" then
                  trace.WriteLn("v_stmt_type= " + v_stmt_type)
                  v_stmt_days = 45
                  end if
                  if v_stmt_type = "Complex Statement - Select" then
                  trace.WriteLn("v_stmt_type= " + v_stmt_type)
                  v_stmt_days = 10
                  end if
                  if v_stmt_type = "Management Company Statement" then
                  trace.WriteLn("v_stmt_type= " + v_stmt_type)
                  v_stmt_days = 20
                  end if
                  xbasic_wait_for_idle()
                  a_dlg_button = ""
                  end if

                  if left(a_dlg_button,4) = "vbeg" then
                  if a_dlg_button = "vbeg_killfocus" then
                  vbeg = ctod(dtoc(vbeg))
                  end if
                  a_dlg_button = ""
                  end if

                  if left(a_dlg_button,4) = "vend" then
                  if a_dlg_button = "vend_killfocus" then
                  vend = ctod(dtoc(vend))
                  end if
                  a_dlg_button = ""
                  end if

                  if a_dlg_button = "vend_change" then
                  a_dlg_button = ""
                  xbasic_wait_for_idle()
                  end if

                  if a_dlg_button = "vbeg_change" then
                  a_dlg_button = ""
                  xbasic_wait_for_idle()
                  end if

                  if a_dlg_button = "save" then
                  a_dlg_button = ""
                  Save(local_variables())
                  xbasic_wait_for_idle()
                  end if

                  if a_dlg_button = "cancel" then
                  a_dlg_button = ""
                  ui_msg_box("Cancel Button Pushed","CANCEL Button Pushed")
                  xbasic_wait_for_idle()
                  ui_modeless_dlg_close(dlg_title)
                  end if


                  %code%)

                  Comment

                  Working...
                  X