B4J Library SD: XUI_Design

Discussion in 'B4J Libraries & Classes' started by Star-Dust, May 11, 2019.

  1. Star-Dust

    Star-Dust Expert Licensed User

    Goodmorning everyone,

    We have often discussed in this forum in different threads about the need to be able to insert XUI from design. We all know that the direction that is suggested by AnyWhere software is to create in the design the native views and then replace B4XView to the type declaration

    Dim V As BXView 'Label
    Clearly many would prefer to be able to do it as a design as understood from the threads, so about a year ago I created the SD_XuiView library that does a sort of wrapping (in reality is not a wrapping but CustomView Class) of the various views (Label, Button, etc.) in respective CustomView for each view by adding some method and animation, like 3D rotations, dragging views, various animations. (See here)

    But creating a CustomView for each view has produced a heavy library full of often repetitive classes.
    So I thought of creating a single CustomView that allows you to insert a design B4XView allowing you to associate it with any view (Button, CheckBox, ImageView, Label, Panel, ProgressBar, RadioButton, ScrollView, Switch, TextArea, TextField, ToggleButton)


    • SDB4XView
      • Functions:
        • BringToFront
        • DesignerCreateView (Base As Object, Lbl As Label, Props As Map)
          Base type must be Object
        • Initialize (Callback As Object, EventName As String)
        • SendToBack
        • SetLayoutAnimated (Duration As Int, Left As Int, Top As Int, Width As Int, Height As Int)
      • Properties:
        • B4XView As B4XView [write only]
          Get or Set View
          eg. SDB4XView1.B4XView=Label
          eg. SDB4XView1.B4XView.Left=0
        • Height
        • Left
        • Top As Int [write only]
        • ViewType As String [write only]
        • Visible As Boolean [write only]
        • Width As Int [write only]

    The views are created by Design as seen from the image. You can select the view you want from the design

    But if you want to change later, you can do it with the command: setViewType(TypeView as String,EventName as String)
    Dim Label1 As Label
    To reposition the view (or visible/BringToFront/SendToBack) it will be used
    SDB4XView1.Left = 0


    True ' Or False
    For all other methods and properties SDB4XView.B4XView.etc etc

    I am sure that not everyone will agree to create a custom View just to save a correction pass in the declarations, others will not find it useful.
    I am convinced that it is right that everyone has their opinion and I do not feel offended that it is different from mine.

    This library is aimed at those few who like me think it's useful.

    Attached Files:

    Last edited: May 11, 2019
  2. LucaMs

    LucaMs Expert Licensed User

    Sorry, but I don't see the usefulness of this thing.

    If I, by Designer, add a SDB4XView and set it as CheckBox, I will not be able to set its Checked property by Designer.
    Same for all specific properties of each native View.
    Last edited: May 11, 2019
  3. LucaMs

    LucaMs Expert Licensed User

    Your library would be useful if the Designer were modified in such a way that, when the type of SDB4xView was selected, the specific properties were "refreshed", displayed (and then available) in the "Custom View Properties" section.
  4. Star-Dust

    Star-Dust Expert Licensed User

    Update 0.02
    Last edited: May 11, 2019
    janderkan and José J. Aguilar like this.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice