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

Looking to mimic a "Mover" control

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

    Looking to mimic a "Mover" control

    Hi
    Is there a way to mimic a mover control in A5? The mover control shows 2 lists, one containing available options, and the other containing selected options, with buttons to move from one to the other (either one by one or all selected in one click).

    In my scenario, i have a certain quantity of passengers that bought a tourism service for a specific date. Depending on the amount of people, the coordinator decides for a quantity of cars. Then, i want that mover to select which people goes to which car.

    Thanks
    Jaime

    #2
    Re: Looking to mimic a "Mover" control

    Search the forum there were a couple of discussions about this. I wish I could remember the titles for you to search. Perhaps someone else knows.
    Win 10 64 Development, Win 7 64 WAS 11-1, 2, Win 10 64 AA-1,2, MySql, dbForge Studio The Best MySQL GUI Tool IMHO. http://www.devart.com/dbforge/mysql/studio/

    Comment


      #3
      Re: Looking to mimic a "Mover" control

      Hi Jamie,

      Have a look at Learning Xdialog, Lesson 8 should give you an idea of what is possible. I think this will be the best way forward.
      Regards
      Keith Hubert
      Alpha Guild Member
      London.
      KHDB Management Systems
      Skype = keith.hubert


      For your day-to-day Needs, you Need an Alpha Database!

      Comment


        #4
        Re: Looking to mimic a "Mover" control

        Thanks Keith. Is it part of my subscription? Where do i find it?

        Comment


          #5
          Re: Looking to mimic a "Mover" control

          Hi Jamie,

          The Xdialog I was referring you to is for the desktop and is in a sub folder of the V11 Program files. This would of course have to be coded differently for web use.

          It was just to give you a thought as to how you might implement your idea, as there are so many ways to do what you want.
          Last edited by Keith Hubert; 04-02-2012, 12:42 PM.
          Regards
          Keith Hubert
          Alpha Guild Member
          London.
          KHDB Management Systems
          Skype = keith.hubert


          For your day-to-day Needs, you Need an Alpha Database!

          Comment


            #6
            Re: Looking to mimic a "Mover" control

            Not sure if you're still looking for this. This works ok. The code below moves items from Dropdown 1 to Dropdown 2. You'll have to duplicate the code or make some changes to implement for the reverse. I'm using MySQL here, and using only 1 table.

            The idea is that the table has an Select ID, a Select Name (displayed in the dropdown) and a boolean field to turn on and off when an item is selected. Items that show in dropdown box 1 have the switch set to 0 and items that display in dropdown box 2 have the switch set to 1. Each time the code is run, the selected item(s) switch is updated and the boxes are re-populated. The code allows for multiple selection and so it can be called from a click event, a double-click event (both of which will move just 1 item) or called from a button which would process all selected items.

            The code is an Ajax Callback and so goes into the Grid's Xbasic Functions section. Lots of error checking needed too. This code looks after the current Row the Grid is in... although a multi-row Grid doesn't really make sense for this.

            Have a look at Video D41 for a lot of this code... so happy it's all out there to get and use.

            Code:
            function SelectUpdate as c (e as p)
            'This function will handle the Ajax callback. 
            'It must return a string of Javscript commands that will be executed in the Browser.	
            
            'The 'e' object contains all of the data that is submitted in the Ajax callback.
            
            'In addition, the 'e' object contains:
            'e._currentRowDataOld - (only if the grid is editable) - original value in the current row before field was edited. 
            '	examples:  e._currentRowDataOld.lastname, e._currentRowDataOld.firstname
            'e._currentRowDataNew as p - current field values in the current row.
            '	examples:	e._currentRowDataNew.lastname, e._currentRowDataNew.firstname
            'e._currentRowKeys - an array containing primary key field values for the current row
            '	example: If the primary key for the table that the grid is based on is 'Lastname' and 'Firstname', 
            '	e._currentRowKeys[1] will contain the value for 'Lastname' and e._currentRowKeys[2] will contain the value for 'Firstname'
            
            'e._gridCurrentFilter - current filter expression if the Grid has been filtered
            'e._gridCurrentOrder - current sort expression
            'e._gridCurentArgumentsXML - XML value of the sql::arguments object for any parameters in the e._gridCurrentFilter property.
            'Note: If the Grid is based on a SQL statement, to get the current SQL statement for the Grid (combining the SQL statement that the Grid is based on 
            'with the current Grid filter and order), you can use this Xbasic:
            'gridSQL = a5_sql_addfilterorder(e.tmpl.cs.sql,e._gridCurrentFilter,"",e._gridCurrentOrder)
            
            'e._isLinkedGrid - .t. if the Grid is a linked Grid (i.e. it has a parent Grid)
            'e._linkValues = linking value. Contains a CRLF delimited list of linking values in this format: fieldname|type|linkingValue
            
            'If the Grid checkbox column is turned on, the 'e' object will contain this properties
            'e.checkboxFilter - a filter command to select all of the checked rows
            'e.checkboxFilterArgumentXML - (for SQL Grids only) if the Grid is based on SQL tables, the e.checkboxFilter property will use arguments (e.g. customerID = :pkValue1)
            '							 - this property contains the XML version of the arguments
            'e.checkboxFilterArgumentsEncoded  - (for SQL Grids only) contains an encoded version of the e.checkboxFilterArgumentXML property that can be used in the .gridFilterSet() method.
            
            
            'In addition, the 'e' object contains:
            'e.tmpl - the Component definition
            'e.session - session variables
            'e.__si - state information that is stored in a hidden field in the component. 
            'e.rtc - holds runtime calculations that are performed when component is executing.
            
            'If you set certain properties in 'e._set' then the appropriate Javascript code will be automatically generated in the Ajax response
            'Examples:
            'e._set.lastname.value = "Smith"    --- will set the value of the 'Lastnme' field in the current row to "Smith"
            'e._set.lastname.style = "color: red;" --- will set the style attribute for the 'Lastname' field in the current row. 
            'e._set.lastname.className = "NewClassName" --- will set the ClassName attribute of the 'Lastname' field in the current row.
            'e._set.firstname.style.color = "red" --- will set the style.color attribute to 'Red' (preserving all other style attributes that had been set)
            'e._set.firstname.style.fontSize = "20pt" -- will set the style.fontSize attribute to '20pt' (preserving all other style attributes that had been set) (Important: the name of the style attribute is case-sensitive)
            
            'To set multiple values in a CheckBox or multi-select Dropdownbox control, set the .value property to a dot
            'variable that contains an array of values. The array must be called 'value'
            'Example:
            'Dim a as p   'a is an arbitrarily named dot variable
            'dim a.value[3] as c 'dim an array called 'value'
            'a.value[1] = "alpha"
            'a.value[2] = "beta"
            'a.value[3] = "gamma"
            'e._set.greekletters.value = a 
            
            'This will select 3 options ('alpha', 'beta' and 'gamma') in the checkbox group for the 'greekletters' control.
            
            
            
            'Note:
            'Assume your callback submitted data from the 'Grid' part, row 3:
            'e._set.lastname.value = "Smith" gets converted to this Javascript code: '{grid.object}.setValue('G','LASTNAME',3,'' + 'Smith',true);' and this code is automatically added to the Ajax response.
            
            'Note:
            'In addition to 'e._set', you can set properties of the 'e._setElement', 'e._setGridElement' and 'e._setRow<rowNumber>' objects.
            'Examples:
            'e._setRow3.lastname.value = "Smith"
            'e._setRow_1.firstname.value = "John" --- sets the value in the first New Record row
            'e._setElement.DIV1.value = "Some text" --- sets the innerHTML of DIV with the id of 'DIV1'
            'e._setGridElement.SPN2.style.color = "Red" ---- sets style properties of a SPAN with id of '{grid.componentname}.SPN2'
            
            
            'example code:
            'Return a Javascript command
            
            'Get the data in the dropdown box
            Dim arraySize as n
            Dim currRow as n
            arraySel = e._currentRowDataNew.OrdName
            arraySize = arraySel.Size()
            currRow = e._currentRow
            
            dim cn as sql::connection
            flag = cn.open("::Name::YOURCONNECTIONNAME","YOURLOGIN","YOURPASSWORD")
            
            dim sql as c
            dim args as sql::arguments
            
            'Update the selected items.  Setting the field to 1 moves the item over the 2nd dropdown box
            FOR x = 1 TO arraySize
            	sql = "UPDATE tblSelect_1 SET ItemSelected = 1 Where SelectId = :argSelId"
            	args.Clear()
            	args.add("argSelId",arraySel[x])
            	flag = cn.execute(sql,args)
            Next x
            
            'Now go get what's left in the table that belongs in the 1st dropdown box
            sql = "SELECT SelectID, ItemName FROM tblSelect_1 WHERE ItemSelected=0"
            
            flag = cn.execute(sql)
            dim rs as sql::resultset
            rs = cn.resultset
            flag = rs.nextRow()
            'If there are any rows left for the 1st dropdown box, set it's initial value as the first item
            if flag then
            	init1 = rs.data("SelectId")
            else
            	init1 = ""
            end if		
            
            'We are now positioned on the first row
            'Construct the data needed to re-populate the 1st dropdown
            dim txt as c
            while flag 
                txt = txt + "['" + rs.data("ItemName") + "', '" + rs.data("SelectId") + "'],"
                'when there are no more records in the ResultSet, executing .nextRow()
                'will return .f., so flag will be .fl and the while loop will end
                flag = rs.nextRow()
            end while
            txt = left(txt,len(txt)-1)
            txt = "[" + txt + "]"
            
            'Go get the items for the 2nd dropdown
            sql = "SELECT SelectID, ItemName FROM tblSelect_1 WHERE ItemSelected=1"
            
            flag = cn.execute(sql)
            rs = cn.resultset
            flag = rs.nextRow()
            if flag then
            	init2 = rs.data("SelectId")
            else
            	init2 = ""
            end if		
            
            'We are now positioned on the first row
            'Construct the data needed to re-populate the 2nd dropdown
            dim txt2 as c
            while flag 
                txt2 = txt2 + "['" + rs.data("ItemName") + "', '" + rs.data("SelectId") + "'],"
                'when there are no more records in the ResultSet, executing .nextRow()
                'will return .f., so flag will be .fl and the while loop will end
                flag = rs.nextRow()
            end while
            txt2 = left(txt2,len(txt2)-1)
            txt2 = "[" + txt2 + "]"
            
            'GRID1.V.R1.ORDNAME - this is the name of my rendered dropdown 
            dim eleId as c = "{Grid.componentname}.V.R" + currRow + ".ORDNAME"
            dim eleId2 as c = "{Grid.componentname}.V.R" + currRow + ".ORDNAME2"
            
            'Execute 2 A5.form.populateSelect statements
            js = "A5.form.populateSelect('" + eleId + "','" + init1 + "'," + txt + ",true);A5.form.populateSelect('" + eleId2 + "','" + init2 + "'," + txt2 + ",true);"
            SelectUpdate = js
            
            end function
            Last edited by Davidk; 04-02-2012, 04:42 PM. Reason: Changed code to look after current row

            Comment


              #7
              Re: Looking to mimic a &quot;Mover&quot; control

              Many thanks David. I am just finishing a completely different approach i had to take to tackle this problem (mainly built a grid where the user selects each time the list of items) but i will definitely use your idea when building the final product, although i may finish building more or less the same functionality, but with 2 grids instead of 2 dropdowns...

              Comment


                #8
                Re: Looking to mimic a &quot;Mover&quot; control

                Not sure about the overhead on this one... lots of calls being made up to the server... then again... it's quite fast.

                Need to make a change to grab the correct row, just in case this is used in a multi-row grid.

                Comment

                Working...
                X