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

what's the wrong logic in this code that has worked for years but now doesn't?

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

    what's the wrong logic in this code that has worked for years but now doesn't?

    I have been using this code for years through many versions of A5 successfully. Now, as of version a5v10_5_3420_3606, it doesn't work. Selwyn says the logic is wrong, should never have worked, and I should study it carefully to discover the "wrong logic". OK, I'm an idiot, because this has been working for years and now it doesn't, and the experiencial knowledge I have derived comes from the experience that this code worked. So I guess I'm just screwed now because what did work that "solidified" my belief of understanding is now being told to me is not correct. It becomes pretty much a rat chasing it's tail. It makes me want to raise a finger.

    Code:
    dim vshow as C
    dim vReply as C
    vReply = ui_dlg_box("Control Panel Access",<<%dlg%
    {background=#165,175,165}
    {lf};
    {region}
    {lf};
    {region}
    {font=arial,8,i}{frame=1,1:Control Panel}{font=arial,12,b}
      (vshow:show!cpt_*)  (vshow:hide!cpt_*)
    {lf}
    {lf};
    {endregion};
    %dlg%,<<%code%
    
    	IF left( a_dlg_button, 4 ) = "cpt_"
    	 IF a_dlg_button = "cpt_change"
    	      a_dlg_button = "end"
    	 END IF
    	END IF
    	%code%)
    	
    	if vshow = "show"
    		:controlpanel.show()
    	else if vshow = "hide"
    		:controlpanel.hide()
    	end if
    Mike W
    __________________________
    "I rebel in at least small things to express to the world that I have not completely surrendered"

    #2
    Re: what's the wrong logic in this code that has worked for years but now doesn't?

    Something is screwed up.. but it is not you. It's the code.
    Something idiotic, not you, the code and the idiotic part is that it will work.

    How?

    Something like what Rick Santilli would say: "the private sector created jobs INSPITE of the governement not BECAUSE of the government."

    I differ with Selwyn here.. it will work.. in an idiotic way.. I think Selwyn took a quick look at it and figured: this is crazy! It can't possibly work!

    I am tempted to tell... but I know if you chill out a bit you will figure it out yourself!
    Or should I?

    Comment


      #3
      Re: what's the wrong logic in this code that has worked for years but now doesn't?

      take a good sleep...

      and return afterwards and have a good look...
      Francis

      Comment


        #4
        Re: what's the wrong logic in this code that has worked for years but now doesn't?

        Your presumption that I haven't looked at this code carefully is more than annoying. If your not going to help me, fine. I guess I really don't care enough anymore. I'll just add the OK button and get rid of the dialog event and move on.
        Mike W
        __________________________
        "I rebel in at least small things to express to the world that I have not completely surrendered"

        Comment


          #5
          Re: what's the wrong logic in this code that has worked for years but now doesn't?

          Mike,
          You've done more xdialogs than I, but when I go to the help file and look at the syntax it looks like you are using a combination of directives--my take is that the following would be "normal" and the original under it commented out is yours....

          Code:
             (vshow={show}!cpt_*)  (vshow={hide}!cpt_*)
          {comment (vshow:show!cpt_*)  (vshow:hide!cpt_*)}
          But as I said, maybe I am not even close! And like you, I get something to work and then assume I must have done it correctly!
          Mike
          __________________________________________
          It is only when we forget all our learning that we begin to know.
          It's not what you look at that matters, it's what you see.
          Henry David Thoreau
          __________________________________________



          Comment


            #6
            Re: what's the wrong logic in this code that has worked for years but now doesn't?

            Mike (W)

            Since this is a Modal dialog it will close if any value is left in a_dlg_button after running through the code section. (I know you know this) You have placed a control on the dialog which produces events that give a_dlg_button a value. You have not, however, taken into account any and/or all events that might result from this.

            After testing I have found that there is a difference between v9 and v10. Place the following line as the first line in the dialog code section. This will give you a list of events in the trace window.
            Code:
            trace.WriteLn(a_dlg_button)
            In v10 I get an event called 'cpt_setfocus'. And I don't get that in v9. That is why it did work and now doesn't. ( I haven't tested previous versions of 10).

            The set focus event happens right away because the radio button is the first control on the dialog and receives focus on startup. (If you were to put another control with no events before the button to take the initial focus the dialog would stay open but as soon as the button gets focus the dialog would close before the variable could get a chance to change value) So at dialog startup you get an event, cpt_setfocus, and thereby a_dlg_button with a value of cpt_setfocus.

            The logic of your code first checks for "cpt_" and gets a yes answer. Then it drops into the next level and looks for "cpt_change". The answer is no so you don't drop into the second IF but continue on with the first level. There is no more to do there so you exit the first level and you are still left with a value in a_dlg_button which closes the dialog.

            As already mentioned, it is the introduction (either a new event or fixing the fact that it wasn't happening in v9) of the setfocus event as a change from v9 that is causing your code to no longer function as it did.

            Ok so how should you do this. Depends on the dialog and what it needs to do.

            In this case since there are really only two options, leave it open or close if any choice is made, I would test only for cpt_change as in the following.
            Code:
            <<%code%
                IF a_dlg_button <> "cpt_change"
                      a_dlg_button = ""
                END IF
                %code%
            If you have developed a methodology where you specifically set a_dlg_button to "end" then something like this will also work
            Code:
            <<%code%
                IF left( a_dlg_button, 4 ) = "cpt_"
                 IF a_dlg_button = "cpt_change"
                      a_dlg_button = "end"
                 END IF
                END IF
                If a_dlg_button <> "end" then
                    a_dlg_button = ""
                end if
                %code%
            Hope this helps and apologies if I rambled.

            EDIT: and here is your original code with a couple extra lines
            Code:
            <<%code%
            trace.WriteLn(a_dlg_button)
            	IF left( a_dlg_button, 4 ) = "cpt_"
            	 IF a_dlg_button = "cpt_change"
            	      a_dlg_button = "end"
            	  Else    
            	      a_dlg_button = ""
            	 END IF
            	END IF
            	%code%
            Tim Kiebert
            Eagle Creek Citrus
            A complex system that does not work is invariably found to have evolved from a simpler system that worked just fine.

            Comment


              #7
              Re: what's the wrong logic in this code that has worked for years but now doesn't?

              Originally posted by Mike Wilson View Post
              Your presumption that I haven't looked at this code carefully is more than annoying. If your not going to help me, fine. I guess I really don't care enough anymore. I'll just add the OK button and get rid of the dialog event and move on.
              Mike:
              You know I am more than happy to help.. it's just something that's so redicullously simple I feel you are in a pretty PO'd mode you must have overlooked it again.. and again.. and again.. and evidently others did too!

              So before we see your picture on TV, here it goes:

              Your code is pretty darn simple. It shows an xdlg with a radio button. Click show and the CP will show, hide and it will hide and that's it. But the code part of your xdlg is what Selwyn probably looked at and said: What?!

              Before we get to that code there is a little trivia that may or may not have any bearing on the outcome and that you put a base event in the radio and later tried to trigger it with "change" which is fine ..but.. what else do you do with a radio?
              I tell you what else later..

              Now to your code. It says:
              Code:
              IF left( a_dlg_button, 4 ) = "cpt_"
              	 IF a_dlg_button = "cpt_change"
              	      a_dlg_button = "end"
              	 END IF
              	END IF
              	%code%)
              You could easily replace that code with:
              Code:
              <<%code%
              .. I bought a new puppy..
              ..he is cute and fluffy..
              ..I named my puppy Joe Kamel..
              %code%
              And it will do exactly the same thing your code does.. which is NOTHING. I am not trying to be cute or sarcastic, I am only trying to illustrate the point..
              your code says:
              If a_dlg_button="something" ' the name event in this case,
              call it (i.e. the a_dlg_button) "something else"
              and that's all it does..
              You assigned a_dlg_button (which is a system varaible) the value "end".. you could have named it "Joe Kamel" and had the same result.
              Then, OUTSIDE the xdlg, you took the value you got from vshow and used it to execute the rest (show CP or hide CP) and that part will work.

              So now back to the initial trivia of the base event in the radio. What else can you do with a radio? besides "change"?
              Setfocus..killfocus..
              That might answer the last question, why did it work before v10?
              My guess is because there were some bugs with setffocus/killfocus and they fixed those and now once you jump into the radio the setfocus event is triggered but there is nothing to do so it most likely will close the xdlg. I can't swear to that since I don't have v10 but I pretty sure that's what will happen.
              So, here is how your code should look like:

              Code:
              dim vshow as C
              dim vReply as C
              ui_dlg_box("Control Panel Access",<<%dlg%
              {background=#165,175,165}
              {lf};
              {region}
              {lf};
              {region}
              {font=arial,8,i}{frame=1,1:Control Panel}{font=arial,12,b}
                (vshow:show)  (vshow:hide)
              {lf}
              {lf};
              {endregion};<OK>
              %dlg%,<<%code%
              IF a_dlg_button = "OK"
               END IF
              if vshow = "show"
              		:controlpanel.show()
              	else if vshow = "hide"
              		:controlpanel.hide()
              	end if
              %code%
              In the future, if you use an event in a radio control and unless you have any use for set/killfocus.. just use a regular event.

              Comment


                #8
                Re: what's the wrong logic in this code that has worked for years but now doesn't?

                OK, OK,
                I love you guys, have I told you that before!!!

                A bit of tube Tube 1 and Tube 2 make green, so when you squeeze some from each tube that will make green..... until they change what's in Tube 2 and you squeeze and mix and it is turns out purple.

                So time to reset the matrix, a bit. Thanks you guys,
                Mike W
                __________________________
                "I rebel in at least small things to express to the world that I have not completely surrendered"

                Comment


                  #9
                  Re: what's the wrong logic in this code that has worked for years but now doesn't?

                  :D Warm and fuzzy moment.

                  PS I guess you didn't get the memo. Purple is the new green. ;)
                  Tim Kiebert
                  Eagle Creek Citrus
                  A complex system that does not work is invariably found to have evolved from a simpler system that worked just fine.

                  Comment


                    #10
                    Re: what's the wrong logic in this code that has worked for years but now doesn't?

                    This thread was never really completed.
                    Code:
                    dim vshow as C=""
                    ui_dlg_box("Control Panel Access",<<%dlg%
                    {background=#165,175,165}
                    {lf};
                    {region}
                    {lf};
                    {region}
                    {font=arial,8,i}{frame=1,1:Control Panel}{font=arial,12,b}
                      (vshow:show!evrb_*)  (vshow:hide!evrb_*)
                    {lf}
                    {lf};
                    {endregion};
                    %dlg%,<<%code%
                    IF left(a_dlg_button,5) = "evrb_"
                    	if a_dlg_button="evrb_change"
                    		if vshow = "show"
                    			:controlpanel.show()
                    		else if vshow = "hide"
                    			:controlpanel.hide()
                    		end if
                    	[COLOR="#FF0000"]else
                    	 a_dlg_button=""[/COLOR]
                    	end if
                    END IF
                    %code%)
                    Mike W
                    __________________________
                    "I rebel in at least small things to express to the world that I have not completely surrendered"

                    Comment


                      #11
                      Re: what's the wrong logic in this code that has worked for years but now doesn't?

                      What a brilliant learning experience this has provided. thank you all.
                      Much more educational (and more fun) than any number of dialog examples.

                      I might suggest using a simple formula in your question to avoid accidents;-
                      Code:
                      FQ = NT x YE
                      where
                      FQ = Frustration Quotient equals
                      {NT = Number of Times re-read and reworked the code multiplied by
                      YE = Years Experience with A5}
                      So Mike W's FQ could have been somewhere around 40*6 = 240.
                      Take a 240 VERY seriously.
                      Tell a <25 to go back and do some work and <5 come back with a real problem

                      Comment

                      Working...
                      X