Rebol Visual GUI is not as primitive as you may think at first glance. You can not only create visual form with simple text fields but also bind your MySQL database to a Rebol’s GridView.

Rebol has no default GridView component but Rebol Visual GUI is extensible so that some people created a GridView (or ListView) here (thanks to Henrik from hmkdesign.dk). To test it just type in Rebol’s Console:


do http://www.hmkdesign.dk/rebol/list-view/list-view.r

view layout [
  list-view with [
    data-columns: ["First Name" "Last Name" "Email"]
    viewed-columns: ["First Name" "Last Name"]
    data: [
      ["John" "Doe" "email hidden; JavaScript is required%MINIFYHTMLaf3ccbe714e8ecf32a2d1b55bbd4c14410%"]
      ["Jane" "Doe" "email hidden; JavaScript is required%MINIFYHTMLaf3ccbe714e8ecf32a2d1b55bbd4c14411%"]
    ]
  ]
]

rebol-listview0

In a previous lesson, you learnt how to connect to MySQL and list all your wordpress posts, you can know easily show them in Rebol’s Gridview by changing the content of the data variable above with the return from the sql select:


    do http://reboltutorial.com/source/mysql-protocol.r
    do http://www.hmkdesign.dk/rebol/list-view/list-view.r

    window: layout [
      list-view 500x400 with [
        data-columns: ["ID" "Post Url" "Post Title"]
        viewed-columns: ["Post Url" "Post Title"]
        data: read/custom mysql://johndoe:123@72.64.23.123/wordpress_db [
          "SELECT DISTINCT ID, post_name, post_title from wp_1_posts WHERE post_type='post' and post_status='publish'"
        ]
      ]
    ]
    view/title window "All Rebol Tutorial's Articles"

As you can see in the code above, you can even show only columns you need from all the columns retrieved from your database.

rebol-listview

Or if you want to show and delete all your Wordpress spams:


    do http://reboltutorial.com/source/mysql-protocol.r
    do http://www.hmkdesign.dk/rebol/list-view/list-view.r

    window: layout [
        list-view 500x400 with [
        data-columns: ["ID" "Author" "comment_author_IP"]
        viewed-columns: ["ID" "Author" "comment_author_IP"]
        data: read/custom mysql://johndoe:123@72.64.23.123/wordpress_db [
          "SELECT DISTINCT COMMENT_ID, comment_author,comment_author_IP from wp_1_comments WHERE comment_approved='spam'"
        ]
      ]
      Button 200x30 "Delete all spams" [
          read/custom mysql://johndoe:123@72.64.23.123/wordpress_db [
          "DELETE FROM wp_1_comments WHERE comment_approved='spam'"
        ]
        Print "Spams deleted."
      ]
    ]
    view/title window "All Rebol Tutorial's Spams"

wordpress-delete-spams

For more features, see documentation and demos.

grid-thumbnail2

Bookmark and Share