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

override a ux conponent property

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

    override a ux conponent property

    I have a ux component with a textarea as the 7th control. I want to override the component properties at run time using following code added to the a5w page.

    Code:
    <%a5
    Delete tmpl_BALLOT_INST1
    DIM tmpl_BALLOT_INST1 as P
    tmpl_BALLOT_INST1 = a5w_load_component("ballot_inst1") ''SYSTEM GENERATED COMMENT - PLEASE DO NOT REMOVE (LOAD:ballot_inst1)
    
    'Override settings start -----------------------------------------
    tmpl_BALLOT_INST1.page_fields[7].v.label = "over"		'added for override
    tmpl_BALLOT_INST1.page_fields[7].v.TextArea.rows = 4	'added for override
    with tmpl_BALLOT_INST1
    	.alias = "BALLOT_INST1"
    _dialogFilename = "ballot_inst1"
    end with 
    'Override settings end -----------------------------------------
    
    delete x_BALLOT_INST1
    dim x_BALLOT_INST1 as p
    x_BALLOT_INST1 = a5w_run_Component(tmpl_BALLOT_INST1) 'SYSTEM GENERATED COMMENT - PLEASE DO NOT REMOVE (RUN:tmpl) (EDIT:ballot_inst1)
    
    ?x_BALLOT_INST1.Output.Head.JavaScript
    ?x_BALLOT_INST1.Output.Head.CSS_Link
    
    ?x_BALLOT_INST1.Output.Head.Title 
    %>
    Neither of the overrides has any effect. Can anyone please tell me what I am doing wrong?
    Thanks, Irwin

    #2
    Re: override a ux conponent property

    Why don't you do this override inside the component instead? I think it would be much easier from there.

    If you are trying to use the same component for different tasks (thus needing to change the label), then set an argument, session variable or a page variable to let the component know what task it's supposed to be performing.

    Comment


      #3
      Re: override a ux conponent property

      You are right I am trying to use the same component for different tasks and I will set a session variable to let the component know the values to use but in this example I used fixed values to keep the code simple. But I can not get this example to work. Does anyone see my error?
      Irwin

      Comment


        #4
        Re: override a ux conponent property

        You will have to pull up the page in Firefox and look at it in Firebug. You need to double check that everything is named what you think it is named.

        Also, you may be having a timing error. If the code to change the text is happening before it is fully initialized then it's probably just getting overwritten again. I don't think there is any way you can be sure that won't happen. That is why you have to do it in the UX - so you have control over WHEN it runs.

        Comment


          #5
          Re: override a ux conponent property

          Hi Larry,
          How can I dynamically change a title of a field in the UX when the UX is desgined but I do not know the title until run time? It seems to me that a field title set in the UX can only be overridden at run time with code in the a5w page. Also I am getting the names of the things to change (tmpl_BALLOT_INST1.page_fields[7].v.label) from the xbasic tab of the UX componant builder. If I put into the a5w page code to show me the value of tmpl_BALLOT_INST1.page_fields[7].v.label I do see the value I entered in the UX at design time. But any change I make does not stick.
          Thanks for your time and interest,
          Irwin

          Comment


            #6
            Re: override a ux conponent property

            when you name the control name alpha give a name, change that to <span id="some_name">your control name</span>
            then insert the component in the a5w page
            in the a5w page write a code
            <script type="text/javascript">
            <!--
            document.getElementById("the name you gave in the span here").innerHTML="new name you want to give here";
            -->
            </script>

            it should work
            thanks for reading

            gandhi

            version 11 3381 - 4096
            mysql backend
            http://www.alphawebprogramming.blogspot.com
            [email protected]
            Skype:[email protected]
            1 914 924 5171

            Comment


              #7
              Re: override a ux conponent property

              Why don't you just use the name of the field instead of page_fields[7]?

              In the UX, you would do basically the same thing, except you would use {dialog_object}.fieldname.v.label

              But since this is just a text field, why not turn it into a label control? Then, based on your variable, you could just use setvalue() to set the value? You could do it in a client side event OR right in the xbasic initialize event.

              Comment


                #8
                Re: override a ux conponent property

                Hey thanks guys,
                I used the title of the field as an example but in fact I want to dynamically change the number of rows in a textarea at run time. I thought that it would be simpler to explain but its confused things. In v9 I was able to change field properties in the override section of the a5w page using a session variable to set the property value. This is not working now and I do not know if that was changed in v12 or since I am using a UX and not a grid or if my coding is wrong. But it is the row size of a textarea that I want to change based on the number of rows in the text in the text area. I have the number of rows in a session variable.
                Thanks for your time,
                Irwin

                Comment


                  #9
                  Re: override a ux conponent property

                  In v9 I was able to change field properties in the override section of the a5w page using a session variable to set the property value.
                  they changed those things starting version 10, take a look at documentation, if you need to change the template dynamically at run time you should declare flag recalculate all controls true at least in grids, may be true in ux too ( i don't know for sure). take a look.
                  thanks for reading

                  gandhi

                  version 11 3381 - 4096
                  mysql backend
                  http://www.alphawebprogramming.blogspot.com
                  [email protected]
                  Skype:[email protected]
                  1 914 924 5171

                  Comment


                    #10
                    Re: override a ux conponent property

                    use the same for rows too.
                    document.getelementById("your span name here').rows = however many you like;
                    that should work too.
                    also if you inspect the element in web inspector you will get the id like this
                    A3.V.R1.THE_NAME_OF THE CONTROL_IN CAPITALS
                    thanks for reading

                    gandhi

                    version 11 3381 - 4096
                    mysql backend
                    http://www.alphawebprogramming.blogspot.com
                    [email protected]
                    Skype:[email protected]
                    1 914 924 5171

                    Comment


                      #11
                      Re: override a ux conponent property

                      Solved!
                      Of course it was in the documentation under "Dynamically Recalculating the Page Layout, Tabbed UI and Dialog Component at Run-time" in alpha anywhere help. gandhi pointed me in the right direction.
                      I needed to add tmpl.flagForceRecalc = .t. either before or after tmpl.page_fields[7].v.TextArea.rows = 4
                      I found that it was field [7] by examining the xbasic tab in the ux builder.
                      Code:
                      'Override settings start -----------------------------------------
                      with tmpl_BALLOT_INST
                      .alias = "BALLOT_INST"
                      _dialogFilename = "ballot_inst"
                      tmpl.page_fields[7].v.TextArea.rows = 4
                      tmpl.flagForceRecalc = .t.
                      end with 
                      'Override settings end -----------------------------------------
                      So now I will set a session variable with the number of lines in the actual text to display and set tmpl.page_fields[7].v.TextArea.rows to that session variable.
                      So thanks for the help both,
                      Irwin

                      Comment


                        #12
                        Re: override a ux conponent property

                        another sample how to change the labels on UX component

                        function drawLabel as c (e as p)
                        dim current_week_start as d = ctod(e.dataSubmitted.current_week_start)
                        debug(1)
                        dim this_monday as d = current_week_start
                        '------------------------------------------------
                        dim new_1 as c = date_format(this_monday+0,"dd")
                        dim new_2 as c = date_format(this_monday+1,"dd")
                        dim new_3 as c = date_format(this_monday+2,"dd")
                        dim new_4 as c = date_format(this_monday+3,"dd")
                        dim new_5 as c = date_format(this_monday+4,"dd")
                        dim new_6 as c = date_format(this_monday+5,"dd")
                        dim new_7 as c = date_format(this_monday+6,"dd")

                        drawLabel = "$('DLG1_TS1.COLUMNTITLES.TOP.SENIN').innerHTML = 'M<br>"+new_1+"';" + \
                        "$('DLG1_TS1.COLUMNTITLES.TOP.SELASA').innerHTML = 'T<br>"+new_2+"';" + \
                        "$('DLG1_TS1.COLUMNTITLES.TOP.RABU').innerHTML = 'W<br>"+new_3+"';" + \
                        "$('DLG1_TS1.COLUMNTITLES.TOP.KAMIS').innerHTML = 'Th<br>"+new_4+"';" + \
                        "$('DLG1_TS1.COLUMNTITLES.TOP.JUMAT').innerHTML = 'F<br>"+new_5+"';" + \
                        "$('DLG1_TS1.COLUMNTITLES.TOP.SABTU').innerHTML = 'Sa<br>"+new_6+"';" + \
                        "$('DLG1_TS1.COLUMNTITLES.TOP.MINGGU').innerHTML = 'Su<br>"+new_7+"';"
                        end function

                        Comment

                        Working...
                        X