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

Refresh bitmap object on form

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

  • Refresh bitmap object on form

    I have a form with a bitmap object on it. A barchart, actually.

    In another process, I'm re-creating the bitmap to re-draw the barchart.

    But I can't figure out how to refresh, redraw or resynch anything to get the current bitmap instead of the one initially loaded with the form.

    parentform, topparent, this etc. refresh, resynch, refresh_layout etc. all don't work.

    Any ideas?
    -Steve
    sigpic

  • #2
    Re: Refresh bitmap object on form

    try

    topparent:Bitmap1.Bitmap.Filename = "Your file name"
    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


    • #3
      Re: Refresh bitmap object on form

      Dang I love this board. Two hours of looking on my part, and 5 minute solution here.

      Thanks Tim.

      This is actually part of the A5/FusionCharts Genie project. I'm now able to display a FusionChart on a form (or report), change the data, and have the FusionChart re-calc immediately, right on the form.

      Video coming real soon.
      -Steve
      sigpic

      Comment


      • #4
        Re: Refresh bitmap object on form

        Your welcome
        Originally posted by Steve Workings View Post
        Video coming real soon.
        I will get the popcorn ready. :)
        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


        • #5
          Re: Refresh bitmap object on form

          Tim - Some experience has shown that your suggestion works mostly, but sometimes not.

          I'm trying to build a reliable example to work with the A5/FusionCharts Genie where you can commit the form's data, re-create the FusionChart image, and display the re-created image on the form.

          I have everything working just fine, but cannot find any reliable way to re-load that bitmap (in this case, a .png.)

          None of these work on a current example I have:
          Bitmap1.refresh()
          Bitmap1.repaint()
          parentform.refresh()
          parentform.resynch()
          form.swap("myformnamehere")

          Tim, or anyone else have another idea?
          -Steve
          sigpic

          Comment


          • #6
            Re: Refresh bitmap object on form

            Hi Steve,

            Originally posted by Steve Workings View Post
            Some experience has shown that your suggestion works mostly, but sometimes not.

            I'm trying to build a reliable example to work with the A5/FusionCharts Genie where you can commit the form's data, re-create the FusionChart image, and display the re-created image on the form.

            I have everything working just fine, but cannot find any reliable way to re-load that bitmap (in this case, a .png.)

            None of these work on a current example I have:
            Bitmap1.refresh()
            Bitmap1.repaint()
            parentform.refresh()
            parentform.resynch()
            form.swap("myformnamehere")
            Tim, or anyone else have another idea?
            I just created a new form, added a PNG bitmap, then added a button with this code
            toggleimg(parentform.this)
            end
            And created a global function with this code

            Code:
            function toggleimg as C(parentptr as P)
            dim shared orgimg as c
            IF orgimg==""
                orgimg=parentform:bitmap1.bitmap.filename
            END IF
            
            IF filename_decode(orgimg)==filename_decode(parentform:bitmap1.bitmap.filename)
                parentform:bitmap1.bitmap.filename=filename_decode("test2.png")
            ELSE
                parentform:bitmap1.bitmap.filename=filename_decode(orgimg)
            END IF
            END FUNCTION
            When I press the button, the image toggles immediately with no other code. I suspect you have other running code or dialog boxes open, so it may not really be the same.

            You should try one or both of these functions, and if both, order may matter, so try it both ways.
            ui_yield()
            xbasic_wait_for_idle()
            When this works, let me know where to send the bill ;). If not, you got the advice for free (and worth every penny!) :D
            Regards,

            Ira J. Perlow
            Computer Systems Design


            CSDA A5 Products
            New - Free CSDA DiagInfo - v1.39, 30 Apr 2013
            CSDA Barcode Functions

            CSDA Code Utility
            CSDA Screen Capture


            Comment


            • #7
              Re: Refresh bitmap object on form

              Looks like that does it Ira. I'll test some more, and I need to modify to be able to manage multiple bitmap objects on a form, each with their own image.

              I'll feed your PayPal account before the day is out.

              Thanks!

              - Steve
              -Steve
              sigpic

              Comment


              • #8
                Re: Refresh bitmap object on form

                Originally posted by Steve Workings View Post
                Looks like that does it Ira. I'll test some more, and I need to modify to be able to manage multiple bitmap objects on a form, each with their own image.
                I'm glad it worked out for you!

                Originally posted by Steve Workings View Post
                I'll feed your PayPal account before the day is out.
                Or maybe a Cabelas gift card? :D
                Regards,

                Ira J. Perlow
                Computer Systems Design


                CSDA A5 Products
                New - Free CSDA DiagInfo - v1.39, 30 Apr 2013
                CSDA Barcode Functions

                CSDA Code Utility
                CSDA Screen Capture


                Comment


                • #9
                  Re: Refresh bitmap object on form

                  I've never figured you for a Cabela's guy Ira. We need to talk more.

                  I've tried, without success, to modify the function. There's a good chance that any one form will contain multiple FusionCharts. So I need for the user to be able to specify which bitmap objects will get refreshed with the current image. And, I'm not worried about the testing that your original function does - I'm glad to just make the run.

                  But, this isn't doing the job. Do you know why?:

                  Code:
                  function Refreshimg as C(objectname as c)
                  	dim orgimg as c
                  	' Get image filename for object:
                  	cmd = "orgimg=parentform:" + objectname + ".bitmap.filename"
                  	evaluate_template(cmd)
                  	' Re-read filename into object:
                  	cmd = "parentform:" + objectname + ".bitmap.filename=filename_decode(orgimg)"
                  	evaluate_template(cmd)
                  END FUNCTION
                  -Steve
                  sigpic

                  Comment


                  • #10
                    Re: Refresh bitmap object on form

                    Hi Steve,

                    Originally posted by Steve Workings View Post
                    I've tried, without success, to modify the function. There's a good chance that any one form will contain multiple FusionCharts. So I need for the user to be able to specify which bitmap objects will get refreshed with the current image. And, I'm not worried about the testing that your original function does - I'm glad to just make the run.

                    But, this isn't doing the job. Do you know why?
                    Yes.












                    Oh...you wanted an answer? :)

                    There is a problem right away that within a function, it has no idea of it's context aliases (in this case parentform). Time to go to my tips on functions and read it. There are ways to derive the parentform pointer, but none of them straightforward (This is one of my pet peeves about A5, that the context of the function's operation, in other words, the thread and aliases are not easily accessible for the typical user).

                    The best way is to add a function parameter, and pass the pointer to the parentform with parentform.this, or pass a pointer to the object itself as in parentform: objectname.bitmap.this in the function call.


                    I also am guessing that you are using the same filename before and after the refresh, and that Alpha may only reload the bitmap image when the name actually changes. If this is the case, create a small png file (maybe transparent, maybe white), and change it to that, then change it to the desired value. You may have to put a UI_YIELD(), and/or XBASIC_WAIT_FOR_IDLE() sequence between the two image loads.

                    As a side note, I never use an evaluate_template(), where an eval could be used. While both will work, it is more complex to debug with evaluate_template() and may have other technical issues if Alpha ever made a code compiler. E.g., I would change your code to

                    Code:
                    function Refreshimg as C(objectname as c)
                        dim orgimg as c
                        ' Get image filename for object:
                        orgimg=eval("parentform:" + objectname + ".bitmap.filename")
                        ' Re-read filename into object:
                        eval("parentform:" + objectname + ".bitmap.filename)=filename_decode(orgimg)
                    END FUNCTION
                    [/quote]
                    Regards,

                    Ira J. Perlow
                    Computer Systems Design


                    CSDA A5 Products
                    New - Free CSDA DiagInfo - v1.39, 30 Apr 2013
                    CSDA Barcode Functions

                    CSDA Code Utility
                    CSDA Screen Capture


                    Comment


                    • #11
                      Re: Refresh bitmap object on form

                      To complete this thread: I asked Selwyn why we were having such trouble reloading the image in the bitmap object. He pointed out that setting the image to blank and then setting it to the filename would work. Here's my (tentatively) final function that allows the user to simply specify the bitmap object name to get it refreshed:

                      Code:
                      function Refreshimg as C(objectname as c)
                      	dim shared orgimg as c
                      	' Get image filename for object:
                      	orgimg=eval("parentform:" + objectname + ".bitmap.filename")
                      	' Set as blank:
                      	eval("parentform:" + objectname + ".bitmap.filename") = ""
                      	' Re-read filename into object:
                      	eval("parentform:" + objectname + ".bitmap.filename") = filename_decode(orgimg)
                      	orgimg = ""
                      end function
                      Ya'll will find this in a future release and upgrade of the A5/FusionCharts Genie.
                      -Steve
                      sigpic

                      Comment


                      • #12
                        Re: Refresh bitmap object on form

                        Hi Steve,

                        Originally posted by csda1 View Post
                        There is a problem right away that within a function, it has no idea of it's context aliases (in this case parentform). Time to go to my tips on functions and read it. There are ways to derive the parentform pointer, but none of them straightforward (This is one of my pet peeves about A5, that the context of the function's operation, in other words, the thread and aliases are not easily accessible for the typical user).

                        The best way is to add a function parameter, and pass the pointer to the parentform with parentform.this, or pass a pointer to the object itself as in parentform: objectname.bitmap.this in the function call.
                        It turns out that at least a5v5 and up (lowest version I checked) do have the parentform and parent aliases defined while running code in the same session, so I am reversing what I said above and have modified my tips above as well. This just takes away one of the biggest limitations of a function I was previously saying, making using a function even better (and easier).

                        Originally posted by csda1 View Post
                        I also am guessing that you are using the same filename before and after the refresh, and that Alpha may only reload the bitmap image when the name actually changes. If this is the case, create a small png file (maybe transparent, maybe white), and change it to that, then change it to the desired value. You may have to put a UI_YIELD(), and/or XBASIC_WAIT_FOR_IDLE() sequence between the two image loads.
                        Originally posted by Steve Workings View Post
                        To complete this thread: I asked Selwyn why we were having such trouble reloading the image in the bitmap object. He pointed out that setting the image to blank and then setting it to the filename would work.
                        What I said above was almost the same as what Selwyn said, only I did not say to use a blank object, although that would be the logical next step, after trying with two different values for the filenames.

                        I still maintain that you might need UI_YIELD(), and/or XBASIC_WAIT_FOR_IDLE() sequence after each image load, as it depends upon the other UI that may be happening at the same time, and would otherwise not necessarily be refreshed.

                        P.S. remove the SHARED in the DIM as it is not necessary and makes for better isolated code.
                        Regards,

                        Ira J. Perlow
                        Computer Systems Design


                        CSDA A5 Products
                        New - Free CSDA DiagInfo - v1.39, 30 Apr 2013
                        CSDA Barcode Functions

                        CSDA Code Utility
                        CSDA Screen Capture


                        Comment


                        • #13
                          Re: Refresh bitmap object on form

                          Thanks Ira. I'll take your recommendations (already removed the shared) and make sure they're in the next package.
                          -Steve
                          sigpic

                          Comment

                          Working...
                          X