B4J Tutorial [BANanoWebix] Lesson 22 - Method 3 (DropZone)

Mashiane

Expert
Licensed User
Ola

Lesson 22 - Method 1
Lesson 22 - Method 2

This method involves the dropzone where one can drag and drop files into the uploader.

Lesson22.3.gif


A list is placed on a page..

B4X:
Dim lst As WixList
    lst.Initialize("mylist").SetTypeUploader(True).SetHeight(600).SetWidth(300).SetScroll(False)
    '
    R1.AddItem(lst.Item)
    '
    pg.AddRow(R1)
    '
    pg.ui
This is linked to the uploader with the .SetTypeUploader(True) call.

Then after the page is created, an uploaded is created, added to the page (it will be invisible) and then a dropzone between the list (mylist) and the uploader (upload) is created with the page's .AddDropZone method..

B4X:
' create an uploader and add it to the page in run-time
    Dim upload As WixUploader
    upload.Initialize("upload").SetApiOnly(True).SetLink("mylist").SetUpload("./assets/upload.php").SetApiOnly(True)
    '
    fu = pg.AddUploader(upload)
    
    'add event
    Dim ffile As BANanoObject
    pg.OnFileUploadError("upload", BANano.CallBack(Me, "onFileUploadError", Array(ffile)))
    pg.onFileUpload("upload", BANano.CallBack(Me, "onFileUpload", Array(ffile)))
    
    'add a dropzone for uploader linked to the list
    pg.addDropZone("upload", "mylist")
We link the list with the uploader by running .SetLink('mylist') call and then link the uploader named 'upload' with the list named 'mylist' with the .AddDropZone call. This enables the bottom part of the list to be a dropzone.

Ta!
 
Top