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

How to save the default bitmap for a button when changed?

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

    #16
    Re: How to save the default bitmap for a button when changed?

    Ted,
    I used your & Stan's first idea of a table. Check it out - hope its not too buggy...

    stepmenu.zip
    Robin

    Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

    Comment


      #17
      Re: How to save the default bitmap for a button when changed?

      Stan,
      I looked at property_to_string() yesterday and could not figure out how to get it to work for setting the button bitmaps.
      Robin

      Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

      Comment


        #18
        Re: How to save the default bitmap for a button when changed?

        Looks good Robin, very good!
        Will you be indicating what the colours mean?
        See our Hybrid Option here;
        https://hybridapps.example-software.com/


        Apologies to anyone I haven't managed to upset yet.
        You are held in a queue and I will get to you soon.

        Comment


          #19
          Re: How to save the default bitmap for a button when changed?

          Actually, I haven't made a final decision about the colors yet. I've thought of disabling the buttons once a section is finished, which would be better indicated by gray or perhaps a check bitmap instead of the orange ball. I also haven't decided yet if using a small pop up type form or full screen makes more sense. But at least the visual effects are working... So far.

          I am curious however in the scripts that change the btnbmp table - which only has the one record, I had to add a fetch_first and fetch-next to get it to work. Wouldn't the table once opened, automatically be on the first record?
          Robin

          Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

          Comment


            #20
            Re: How to save the default bitmap for a button when changed?

            Instead of parentform:buttonobjectname.fill.color you would use

            parentform:Tool_select1.Default.Hbitmap.Bmplib = "<ADDIN>" 'discover the value here in the form object explorer
            parentform:Tool_select1.Default.Hbitmap.Bmptag ="$$application.alpha" 'discover the value here in the form object explorer
            There can be only one.

            Comment


              #21
              Re: How to save the default bitmap for a button when changed?

              Stan,
              I get that part. What I don't understand is how to parse the saved string back to the button's property. I am more than a bit weak on using lists in this fashion.
              Robin

              Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

              Comment


                #22
                Re: How to save the default bitmap for a button when changed?

                str = GET_FROM_FILE("c:\mydata\dot_variables.txt") 'replace txt file location with networked location
                dim btncolors as P
                btncolors.dummy = ""
                property_from_string(btncolors, str)

                Recreates the pointer variable just as it was when saved to the file.

                lst = parentform.Child_Enum("button")
                for each foo in lst
                eval("parentform."+foo.value+".fill.color") = eval("btncolors."+foo.value)
                next

                Would do the reassignment to the buttons.
                There can be only one.

                Comment


                  #23
                  Re: How to save the default bitmap for a button when changed?

                  Stan,
                  Did you look at my zip? Perhaps we could work with an example from the actual data I provided. Something I could try in the IW?

                  See post #16
                  Robin

                  Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

                  Comment


                    #24
                    Re: How to save the default bitmap for a button when changed?

                    Finally, I have something that works in the IW - now how do I use the final btndata result?

                    ?topparent.Name()
                    = "Step_Menu"
                    lst = topparent.Child_Enum("f=button")
                    lst = sortsubstr(lst,crlf())
                    dim str1 as c = ""
                    str1 = *for_each(btn,btn.value+".default.hbitmap.bmptag",lst)
                    ?str1
                    = B_1.default.hbitmap.bmptag
                    B_2.default.hbitmap.bmptag
                    B_3.default.hbitmap.bmptag
                    B_4.default.hbitmap.bmptag
                    B_B1.default.hbitmap.bmptag
                    B_B2.default.hbitmap.bmptag
                    B_B3.default.hbitmap.bmptag
                    B_C1.default.hbitmap.bmptag
                    B_C2.default.hbitmap.bmptag
                    B_C3.default.hbitmap.bmptag
                    B_Close.default.hbitmap.bmptag
                    B_D1.default.hbitmap.bmptag
                    B_D2.default.hbitmap.bmptag
                    B_NewWeek.default.hbitmap.bmptag
                    B_PrevWeek.default.hbitmap.bmptag

                    dim str2 as c = ""
                    str2 = *for_each(bmp,quote(alltrim(eval(bmp.value))),str)
                    ?str2
                    = "GrayRarrw"
                    "GrayRarrw"
                    "$$generic.orb.green"
                    "$$generic.orb.green"
                    "redchk"
                    "redchk"
                    "$$generic.orb.green"
                    "$$generic.orb.green"
                    "$$generic.orb.green"
                    "$$generic.orb.green"
                    "$$generic.exit"
                    "$$generic.orb.green"
                    "$$generic.orb.green"
                    "$a5_expand"
                    "a5_htmled_delete_cell"

                    dim btns[cnt] as c
                    dim bmps[cnt] as c
                    btns.initialize(str1)
                    bmps.initialize(str2)

                    dim btndata as c = ""
                    for i = 1 to cnt
                    btndata = btndata+alltrim(btns[i])+"="+bmps[i]+crlf()
                    next
                    msgbox("result",btndata,0)

                    ?btndata
                    = B_1.default.hbitmap.bmptag="GrayRarrw"
                    B_2.default.hbitmap.bmptag="GrayRarrw"
                    B_3.default.hbitmap.bmptag="$$generic.orb.green"
                    B_4.default.hbitmap.bmptag="$$generic.orb.green"
                    B_B1.default.hbitmap.bmptag="redchk"
                    B_B2.default.hbitmap.bmptag="redchk"
                    B_B3.default.hbitmap.bmptag="$$generic.orb.green"
                    B_C1.default.hbitmap.bmptag="$$generic.orb.green"
                    B_C2.default.hbitmap.bmptag="$$generic.orb.green"
                    B_C3.default.hbitmap.bmptag="$$generic.orb.green"
                    B_Close.default.hbitmap.bmptag="$$generic.exit"
                    B_D1.default.hbitmap.bmptag="$$generic.orb.green"
                    B_D2.default.hbitmap.bmptag="$$generic.orb.green"
                    B_NewWeek.default.hbitmap.bmptag="$a5_expand"
                    B_PrevWeek.default.hbitmap.bmptag="a5_htmled_delete_cell"
                    Last edited by MoGrace; 06-29-2014, 05:41 PM. Reason: better results to show
                    Robin

                    Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

                    Comment


                      #25
                      Re: How to save the default bitmap for a button when changed?

                      Try

                      eval("btn.bmp"+ltrim(str(i))) = eval(foo.value+".default.hbitmap.bmptag")

                      The eval() on the left side of the equals is the trick.


                      As in

                      i = 3

                      "btn.bmp"+ltrim(str(i)) = "ABC"
                      ? btn.bmp3
                      ERROR: Not found
                      btn not found.


                      eval("btn.bmp"+ltrim(str(i))) = "ABC"
                      ? btn.bmp3
                      = "ABC"
                      There can be only one.

                      Comment


                        #26
                        Re: How to save the default bitmap for a button when changed?

                        Stan! I knew you would be here
                        Notice the btndata text looks just like I would write it for a script. What I can't seem to figure out is if I save that to a text file in my close button, what must I do to get that back into the script that loads the form? I assume I will need evaluate_template to iterate thru the string to issue the commands. Would a For...Next loop do that ?
                        Robin

                        Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

                        Comment


                          #27
                          Re: How to save the default bitmap for a button when changed?

                          btndata is a string.

                          SAVE_TO_FILE() saves a string to a file.
                          GET_FROM_FILE() opens a text file and creates a variable from the contents of the file.
                          FOR EACH ... NEXT iterates through that variable
                          For...Next would probably do but would you require you to determine how many lines are in the variable and parse the variable into "words".

                          FOR EACH ... NEXT is expecting each line to be what you want to use, doesn't care how many there are, and exits when the last is processed.
                          Last edited by Stan Mathews; 06-29-2014, 09:47 PM.
                          There can be only one.

                          Comment


                            #28
                            Re: How to save the default bitmap for a button when changed?

                            If I type in the IW with Step Menu open

                            B_1.default.hbitmap.bmptag = "$$generic.orb.blue"

                            The bitmap is changed.

                            However if I try:

                            Evaluate_template(B_1.default.hbitmap.bmptag = "$$generic.orb.blue")

                            Nothing happens. Nor does changing it to "B_1.default.hbitmap.bmptag = "+"$generic.orb.blue" do anything. I also tried using quote(). What does this function expect?

                            Never mind, this works:
                            *for_each(foo,evaluate_template(foo.value),lst)

                            I'm trying too hard...
                            Last edited by MoGrace; 06-29-2014, 11:31 PM.
                            Robin

                            Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

                            Comment


                              #29
                              Re: How to save the default bitmap for a button when changed?

                              As should

                              for each foo in lst
                              evaluate_template(foo.value),lst)
                              next
                              There can be only one.

                              Comment


                                #30
                                Re: How to save the default bitmap for a button when changed?

                                Here's my working UDF to open the form with the last saved bitmaps.
                                Code:
                                FUNCTION Get_Btns AS C (txtfile = "btn_bmp.txt" as C )
                                'DESCRIPTION: Open Step Menu and read the btn_bmp.txt file and set the button bitmaps
                                'Used in calling script that opens the Step Menu form with last saved button bitmaps
                                	dim global co_path as c		
                                	dim bmpstr as c = ""
                                	dim btnlst as c = ""
                                	dim command as c
                                	dim frm as p 
                                	dim frmname as c = "Step Menu"
                                		
                                	vw_frm(frmname)  'my UDF to open the form or switch if active
                                	frm = obj(frmname)
                                	
                                	if txtfile = "" then	
                                		'Ex to prompt for file: get_btns("")
                                		txtfile = co_path+chr(92)+"btn_bmp.txt"
                                		getfile = ui_get_file("Select Txt File","*.txt",txtfile,"X")
                                		if getfile = "" then
                                			'user cancelled
                                			goto ENDIT
                                		end if		
                                	else
                                		'Ex to use defaults: get_btns()
                                		getfile = co_path+chr(92)+txtfile
                                	end if
                                	
                                	'Check the file exists and put contents into string
                                	if file.exists(getfile)
                                		bmpstr = get_from_file(getfile)
                                	end if					
                                	
                                	if bmpstr <> "" then		
                                		*for_each(bmp,evaluate_template("frm:"+bmp.value),bmpstr)			
                                	end if	
                                	
                                	btnlst = a5.Child_Enum("f=buttons")
                                	if btnlst <> "" then
                                		*for_each(btn,evaluate_template("frm:"+btn.value+"refresh()"),btnlst)						
                                	end if				
                                	
                                	ENDIT:
                                	trace.WriteLn("Get Btns: "+bmpstr)
                                	Get_Btns=bmpstr
                                	
                                END FUNCTION
                                Last edited by MoGrace; 06-30-2014, 03:49 PM.
                                Robin

                                Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

                                Comment

                                Working...
                                X