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

Remove Windows close icon (Red X)

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

    Remove Windows close icon (Red X)

    with A5 v10.5...Is there a way to remove the Windows close icon (Red X in upper right)?

    I do not see a way here .... http://support.alphasoftware.com/alp...ne_Options.htm

    Something like the -NOMINMAX option except one that removes the close button. I tried -NOCLOSE as a test but no go.

    I have an Exit button on all my forms and want to force the users to close via the button so I can run a logoff script.

    I would like to know if anyone else has a possible solution to this?

    #2
    Re: Remove Windows close icon (Red X)

    You need to uncheck the system menu in the form properties under the window tab
    -----------------------------------------------
    Regards
    Mark Pearson
    [email protected]
    Youtube channel
    Website

    Comment


      #3
      Re: Remove Windows close icon (Red X)

      Mark, thank-you for your response. I have the System Menu option unchecked on every form in my app. See the attached screen shot as an example. All forms in app have the same settings on this tab.

      The only form open when the application is launched is the MAIN_MENU form although as you can see from the other attached pic the min, max and close buttons are still available. If I add -nominmax to my startup file the min and max button are removed although I have not found a way to remove the close icon.

      any ideas?

      Comment


        #4
        Re: Remove Windows close icon (Red X)

        Hi Scott,

        Are you just trying to keep users from closing the application with the Windows "X"?

        Ed

        Comment


          #5
          Re: Remove Windows close icon (Red X)

          Originally posted by Ed Barley View Post
          Hi Scott,

          Are you just trying to keep users from closing the application with the Windows "X"?

          Ed
          Yes, any suggestions?

          Comment


            #6
            Re: Remove Windows close icon (Red X)

            Hi Scott,

            There are 4 functions, that go in the autoexec, 1 script, and code for your main menu exit button on the main menu form, that will do exactly that. I have been using it for a few years.

            I can't get it together right now. But I will get it to you.
            I believe Stan Mathews and someone else had come up with this a few years back.

            Has never given me any trouble.

            Ed

            Comment


              #7
              Re: Remove Windows close icon (Red X)

              Ed,

              That sounds great. I will wait for the post.

              Scott

              Comment


                #8
                Re: Remove Windows close icon (Red X)

                I found these in the help

                ON_DATABASE_EXIT() and CAN_DATABASE_EXIT()

                Not sure how they are applied yet, but may be what you are looking for
                -----------------------------------------------
                Regards
                Mark Pearson
                [email protected]
                Youtube channel
                Website

                Comment


                  #9
                  Re: Remove Windows close icon (Red X)

                  Scott,

                  This goes in your autoexec :


                  HTML Code:
                  'Run script locally (using local variables)
                  script_play_local("XExitLock") '
                  'Establish the system path into a variable
                  dim global systempath as C
                  SystemPath = a5.get_path()
                  'Establishes the vcFNow variable for the Form_nav() function
                  dim global vcFNow as C
                  vcFNow = "NAME OF YOUR MAIN MENU FORM GOES HERE"
                  First function named "Form_Enum"


                  HTML Code:
                  '=== this function generaates 4 variables that delineate the Forms Open
                  'vOpenFW = ALL OPEN FORMS 
                  'vOpenWin = ALL OPEN WINDOWS
                  'vOpenO = NON-CURRENT WINDOWS
                  'vOpenH = HIDDEN WINDOWS
                  ' tHIS IS USED IN THE FormEit() function to test for lastness
                  FUNCTION form_enum AS C ( )
                  '====== Stan Mathew's Open Form Script. The output vOpenF is a list of the 
                  ' forms that are open
                  dim shared vOpenF as C
                  lst = a5.form_enum(2)
                  vOpenF = ""
                  cnt = w_count(lst,crlf())
                  FOR i = 1 TO cnt
                  IF is_object(word(lst,i,crlf()))
                  vOpenF = vOpenF + crlf()+word(lst,i,crlf())
                  for m = 1 to 100
                  IF is_object(word(lst,i,crlf())+alltrim(str(m-1)))
                  vOpenF = vOpenF + crlf()+word(lst,i,crlf())+alltrim(str(m-1))
                  end if
                  next m
                  END IF
                  NEXT i
                  vOpenF = stritran(vOpenF,crlf(),"",1,1)
                  'ui_msg_box("Forms open:", vOpenF)
                  '========== begin WINDOW OPEN SECTION ==================
                  dim shared vOpenFW as C=""
                  dim shared vOpenWin as C=""
                  dim shared vOpenO as C=""
                  dim shared vOpenH as C=""
                  dim shared vcurrentW as C
                  dim shared vLenum as N
                  ' 'a_form_current
                  vcurrentW = a_form_current
                  'ui_msg_box("vCurrentW:", vCurrentW)
                  ' All Open Windows
                  vOpenWin = a5_list_open_windows()
                  'ui_msg_box("vOpenW:", vOpenWin)
                  ' Combined and culled
                  vOpenFW = word_unique(vOpenF+crlf()+vOpenWin,crlf())
                  vLenum = w_count(vOpenFW,crlf())+3
                  'msgbox("All Open Forms"+str(vLenum), vOpenFW)
                   
                  'Windows other than CURRENT
                  vOpenO = word_subtract(vOpenFW,vCurrentW,crlf())
                  'ui_msg_box("Other Open Windows:", vOpenO)
                   
                  ' Hidden Windows
                  vOpenH = word_subtract(vOpenFW,vOpenWin,crlf())
                  'ui_msg_box("HIDDEN:", vOpenH)
                  END FUNCTION

                  Second Function named "Form_Exit"

                  HTML Code:
                  FUNCTION form_exit AS C ( )
                  ' collect the name of the current form
                  dim global vcFcurrent as C
                  vcFcurrent = a_form_current
                  'This is a script so won't close window if last one for when Control Panel Hidden
                  dim vwinchk as C
                  dim vcurrentW as C
                  dim shared vwinT as C
                   
                  vcurrentW = a_form_current
                  vwinchk = a5_list_open_windows()
                  vwinchk = word_subtract(vwinchk,vcurrentW,crlf()) ' remove the current window from the list of open windows
                  vwinchk = word_subtract(vwinchk,"controlpanel",crlf()) ' remove the Control Panel from the list of Open Windows
                  ui_msg_box("Open Windows",vwinchk,64)
                   
                  if vwinchk = vcurrentW then
                  Form.view("Mainmenu")
                  parentform.close(.f.)
                  else
                  vwinT = "go"
                  'Close current form or browse window.
                  DIM mode as c
                  mode = parentform.mode_get()
                  'If the form is in Enter or Change mode, first save the changes before closing the form
                  if mode = "ENTER" .or. mode = "CHANGE" then
                  parentform.commit()
                  'Check to see if the record was successfully saved
                  if parentform.mode_get()<>"VIEW" then
                  ui_msg_box("Unable to save your changes","Please correct and save, or discard your changes", UI_STOP_SYMBOL)
                  end
                  end if
                  end if
                  'Close the form
                  parentform.close(.f.)
                  end if
                  END FUNCTION

                  third function named "Form_Nav"

                  HTML Code:
                  FUNCTION Form_nav AS C ( )
                  dim global vcFfrom as C
                  vcFfrom = vcFNow
                  dim global vcFNow as C
                  vcFNow = a_form_current
                   
                  dim global vfname as C
                  dim global vFpointer as C
                  vFname = a_form_current
                  vFpointer = a_form_current
                  END FUNCTION
                  forth function named "P_Msg_Box"

                  HTML Code:
                  FUNCTION p_msg_box AS C (title AS C, message ="", buttons ="OK", image ="" )
                  'DESCRIPTION:Message Box allows user text on buttons. Buttons= comma or crlf() list, or full xdialog code, Image= information, question, warning, error, or full image name. Return is button name.
                  'EXAMPLES:
                  'p_msg_box("test","message here","OK, Cancel","question")
                  'p_msg_box("test","message here","button 1 text!one, button 2 text!two","a5_a5icon32") ' returns "one" or "two"
                  'p_msg_box("test","message here","<15Button1> <20Button2>")
                  'p_msg_box("test","message line1"+crlf()+"message line2")
                  rows=line_count(message)
                  cols = max_str_length(message,crlf())
                  dlg_format = <<%dlg%
                  {lf=.5};
                  {region1}
                  *image_region*
                  {sp}{sp}{sp}{region3}{lf=.5};
                  *msg_text*
                  {endregion3};
                  {endregion1}
                  {lf};
                  {region}{justify=center,center}
                  *button_region*
                  {endregion}
                  %dlg%
                  ' ***** buttons *****
                  'this makes it possible to have a comma in the button text
                  if occurs(crlf(), buttons) = 0
                  buttons = stritran(buttons,",",crlf())
                  end if
                  'now have crlf() string
                  buttons = *for_each(button, alltrim(button), buttons)
                  btn_length = max_str_length(buttons, crlf())
                  if btn_length > 10
                  btn_length = btn_length +4
                  else
                  btn_length = 15
                  end if
                  if occurs("<",buttons) = 0 ' only text entered, so build complete buttons
                  buttons = *for_each(button,"<"+btn_length+button+">",buttons)
                  else
                  ' do nothing. user entered complete button format
                  end if
                  buttons = stritran(buttons, crlf()," ")
                  dlg_format = stritran(dlg_format,"*button_region*", buttons)
                  ' ***** image *****
                  image_format = <<%dlg%
                  {region2}{image=*img*}{endregion2}
                  %dlg%
                  if image = ""
                  image_format = ""
                  elseif lower(image) $ "question,error,warning,information"
                  image_format = stritran(image_format,"*img*", "$sys_"+alltrim(image))
                  else
                  image_format = stritran(image_format,"*img*",alltrim(image))
                  end if
                  dlg_format = stritran(dlg_format,"*image_region*", image_format)
                  ' ***** message *****
                  dlg_format = stritran(dlg_format,"*msg_text*","{text=%H=R%"+cols+","+rows+":message}")
                  vReply = ui_dlg_box(title,dlg_format)
                  p_msg_box = vReply
                  END FUNCTION

                  Script named "XExitlock"

                  HTML Code:
                  ' Lock the Windows "X" button from closing the form
                  DIM code as C
                  code = <<%code%
                  CANCEL()
                  DIM vForm as C
                  vForm = a_form_current
                  evaluate_template(":"+vcFNow+".close(.f.)")
                  :Form.view("Main Menu Main")
                  %code%
                  can_database_exit(code)

                  Exit button code on Main Menu :

                  HTML Code:
                  dim vexit as C
                  vexit = p_msg_box("NOTICE","Are you certain you wish to exit ","Exit!exit, Cancel!Cancel")
                  if vexit = "exit" then
                  system_event_drop("database_canexit","1")
                  'Exit Alpha Five.
                  :a5.close()
                  end if

                  Wish I could take the credit for this, but I can not. I can't find the post or archive from where I got it. Stan Mathews had a good part in it. It has been working perfect for a long time.

                  So, any time the Windows "X" is pressed, the application always returns to the main menu. So that the application will close from the main menu form's exit button only.

                  I did this on the quick. Make sure you use a test copy of your application till you feel confident it is doing what it should.

                  Ed

                  Comment


                    #10
                    Re: Remove Windows close icon (Red X)

                    Scott,

                    Here is what I have used for a while and it has worked for me. I have not used Xbasic much as I am still learning.

                    This was suggested to me a while back by Selwyn Rabins. So here is what I have been using:

                    To prevent closing by using the "X"
                    On my main menu I use action scripting "cancel event" on the main menu form's "canexit" event.
                    This prevents the"X" from working.

                    I Use the following code on a hidden button to close the Main menu and access the control panel.
                    topparent.code.canExit = ""
                    parentform.close()

                    To quit the application, on the "onpush" event of a "Quit Application or Exit" buttion I use action scripting to display a message box asking if the user was ready to quit the application. If "yes" is chosen it runs the following inline xbasic

                    'Exit Alpha Five.
                    :a5.close(.t.)

                    Hope this helps,

                    Carl

                    Comment


                      #11
                      Re: Remove Windows close icon (Red X)

                      Don't know about all the code mentioned but I simply used the simple example script in the help for CAN_DATABASE_EXIT(). Place in my autoexec and it does the trick.

                      I was not aware of this function so it is now in use in my programs and is very handy. Thanks. would not have looked for it without this post
                      -----------------------------------------------
                      Regards
                      Mark Pearson
                      [email protected]
                      Youtube channel
                      Website

                      Comment


                        #12
                        Re: Remove Windows close icon (Red X)

                        I really appreciate all of your feedback, this has been a very informative post.

                        I ended up using the on_database_exit function. It solved my original problem of not being able to run a logoff script if an individual clicks the Close button (Red X)

                        Perfect, thanks everyone!!

                        Comment

                        Working...
                        X