Array of controls in Web

  1. 2 weeks ago

    John S

    May 7 Pre-Release Testers, Xojo Pro

    I've been trying to use a solution presented for desktop in a web app but nothing is visible. Did I miss something or does this not work in a web app?

    My Code:

    dim labelsArray as webLabel(-1)

    dim top as integer = 0
    for i as integer = 0 to 4
    labelsArray.append new lblTest
    next i

    for i as integer = 0 to 4
    top = top + labelsArray(i).height + 10
    labelsArray(i).left = 20
    labelsArray(i).top = top
    labelsArray(i).enabled = true
    labelsArray(i).text = "Test Label " + str(i)
    labelsArray(i).visible = true
    next i

  2. Michel B

    May 7 Pre-Release Testers RubberViews.com

    You cannot create new members that way. To add controls dynamically to a web page, use Webcontainers.embedwithin.

  3. John S

    May 8 Pre-Release Testers, Xojo Pro

    Thanks . . .

    My app relies heavily on containers.

    This is yet another attempt to create a drag-and-drop between web list boxes.

  4. Tim P

    May 8 Pre-Release Testers Rochester, NY

    @John S This is yet another attempt to create a drag-and-drop between web list boxes.

    You need to find a way to do it in Javascript, not Xojo; or you're just hurting the user.

  5. John S

    May 8 Pre-Release Testers, Xojo Pro

    You need to find a way to do it in Javascript, not Xojo; or you're just hurting the user.

    Why's that?

  6. Tim P

    May 9 Pre-Release Testers Rochester, NY
    Edited 2 weeks ago

    @John S Why's that?

    Because of the way Xojo Web currently works. All of your Xojo code is compiled server side. Every action the user performs that interacts with your Xojo code has to go all the way to the server, be processed, and go all the way back to the user. This delay is variable and cannot be relied on in any manner.

    Any kind of interface action, such as drag & drop, needs to be implemented in the browser.

  7. last week

    John S

    May 10 Pre-Release Testers, Xojo Pro

    Thanks . . .

  8. Greg O

    May 11 Xojo Inc

    @John S Thanks . . .

    Have you looked at the web drag and drop examples?

  9. John S

    May 11 Pre-Release Testers, Xojo Pro

    I have Greg . . . but they won't work between list boxes.

  10. Hal G

    May 12 Pre-Release Testers, Xojo Pro, XDC Speakers CampSoftware.com

    @John S but they won't work between list boxes

    You might be able to get this to work in Web Framework 1.0 by embedding WebContainers into the WebListbox. However, this will break in Web Framework 2.0. But if you need it now, it works great!

    You can find a demo at the bottom of this thread that I created with help from @Brock N. This should let you add a control that can accept drags to a WebContainer that you embed in a WebListbox: https://forum.xojo.com/46100-what-can-i-embed-within-a-weblistbox/11#p422157

    If you like the idea of embedding WebContainers in WebListboxes, please add this to your top feedback case which is at 56th: Feedback Case #54683

  11. John S

    May 12 Pre-Release Testers, Xojo Pro

    Hal . . . . What do you mean it will break in Web Framework 2.0 ?

    My web apps use a lot of containers

  12. 7 days ago

    John S

    May 12 Pre-Release Testers, Xojo Pro

    This sounds like a dumb question but . . .

    I'm testing dragging and dropping containers but I need to identify the container I've dragged and get data from it.

    I've tried using controlWithID but it doesn't work.

    I've tried setting properties when the mousedown event happens but it won't allow drag and drop.

    ideas?

  13. Michel B

    May 12 Pre-Release Testers RubberViews.com

    Your best bet would be to create the web equivalent of the desktop listbox, with webcontainers. Contrary to the webListbox, the desktop listbox does not smooth scroll. Rows never move, only data. That makes creating it's web equivalent relatively easy. And it would enable dragging and dropping between grids.

  14. Hal G

    May 13 Pre-Release Testers, Xojo Pro, XDC Speakers CampSoftware.com

    @John S What do you mean it will break in Web Framework 2.0

    The embedding of Containers in Listboxes uses javascript to move the containers. That specific javascript won't work in Web FW 2.0.

    But in Web FW 2.0 Containers will be able to 'float left' essentially creating a list of containers if placed in a surrounding container.

  15. 6 days ago

    John S

    May 13 Pre-Release Testers, Xojo Pro
    Edited 6 days ago

    Thanks guys. I'm working on it.

    How do I identify the container that has been dragged so I can get information from its properties?

  16. John S

    May 13 Pre-Release Testers, Xojo Pro

    So I've tried a rawdatadrop but it doesn't show the property values from the dragged container . . . nor does it retain the property values

  17. Maurizio R

    May 13 Pre-Release Testers, Xojo Pro
    Edited 6 days ago

    WebControl.DropObject
    The obj parameter is the element that was dragged.

  18. 5 days ago

    John S

    May 14 Pre-Release Testers, Xojo Pro

    Thanks Maurizio . . . But I can't get any information from the object's properties.

    One try: msgbox obj.sender.skillname (skillname is a property in the dragged container

    Error: Type "WebControl" has no member named "skillname"

    Second try: (after putting the dragged container's control ID in the label for the dropped control (labelContainer.Label1.text = obj.sender.controlID))

    msgbox controlwithID(labelContainer.Label1.text).skillname

    Error: Type "WebControl" has no member named "skillname"

    Third try: (after putting the dragged container's control ID in the label for the dropped control (labelContainer.Label1.text = obj.sender.controlID))

    msgbox controlwithID(labelContainer.Label1.text).Label1.text

    Error: Type "WebControl" has no member named "Label1"

    So I'm still stuck on how to get data from properties or the contents of the dragged container.

    Thanks for your help

  19. Maurizio R

    May 15 Pre-Release Testers, Xojo Pro
    Edited 5 days ago

    The Sender property is a WebControl that you must check with the IsA operator and refer using cast.
    As an example if your dragged container type is myDraggableContainer:

    If obj.Sender IsA myDraggableContainer Then
    dim TheDraggedContainer as myDraggableContainer = myDraggableContainer(obj.Sender)
    // Now you can refer to any public property or method of the dragged container
    TheDraggedContainer.skillname...
    End If

    Look at the IsA operator for examples on type Casting.

or Sign Up to reply!