Dim jQ as BANanoObject
jQ.Initialize("$")
JQ.Selector("#jqxButton").RunMethod("jqxButton", CreateMap("width": 120, "height": 40))
Sub Process_Globals
Private BANano As BANano
End Sub
Sub AppStart (Form1 As Form, Args() As String)
BANano.Initialize("BANanoJQWidgets", "BANanoJQWidgets", 1)
BANano.UseServiceWorker = False
BANano.HTML_NAME = "index.html"
BANano.Header.Title = "BANanoJQWidgets"
BANano.Header.AddCSSFile("https://jqwidgets.com/public/jqwidgets/styles/jqx.base.css")
BANano.Header.AddJavascriptFile("https://code.jquery.com/jquery-3.3.1.min.js")
BANano.Header.AddJavascriptFile("https://jqwidgets.com/public/jqwidgets/jqx-all.js")
BANano.Build("C:\inetpub\wwwroot\BANano\") ' <-- adjust to your needs!
ExitApplication
End Sub
Sub BANanoJQWidgets_Ready()
Dim HTML As String = $"<input type="button" value="Button" id="jqxbutton" />"$
BANano.GetElement("body").Append(HTML)
Dim jQuery As BANanoObject
jQuery.Initialize("$")
jQuery.Selector("#jqxbutton").RunMethod("jqxButton", CreateMap("width":"150", "height":"50"))
End Sub
Dim event As BANanoEvent ' dummy declaration so B4J doesn't give an error in the next line for the param of the callback
mJRating.RunMethod("bind", Array("change", BANano.CallBack(mCallBack, mEventName & "_change", event))) ' _change must be lowercase!
Absolutely! As you are making it as a Custom View, you can just use the Abstract Designer, drop one of your jqxRating objects on in and use the generate members method. Just adding some simple normal B4J code et voila!Is this the way to go to create a jqWidget wrapper for BANano ?
Sub BANanoJQWidgets_Ready()
BANano.LoadLayout("#body", "layout1")
End Sub
Sub jqxRating1_Change (event As BANanoEvent)
BANano.Alert("ok")
End Sub
Sub jqxRating1_Change (event As BANanoEvent)
Dim ev As BANanoObject
ev.Initialize(event)
Log(ev.GetField("value"))
BANano.Alert("ok")
End Sub
Log(event.Value)
Log(event.OtherField("value"))
very good!I'll add .value and a method .otherField(name) for any other field which is not wrapped.
mJRating.RunMethod("jqxRating","disable")
Shouldn't it be? (untested)
B4X:mJRating.RunMethod("jqxRating","disable")
as 'disable' seems like a param of the method jqxRating
so, the BANanoCode looks like this:To set a property(option), you need to pass the property name and value(s) in the jqxButton's constructor.
$("#jqxbutton").jqxButton({ disabled: true });
jQuery.Selector("#jqxbutton").RunMethod("jqxButton", CreateMap("disabled":True))
j = BANano.Window.GetField("JQXElements")
JQXElements.settings["buttonSettings"] =
{
width:120,height:40, value:"Button", theme:"light"
}
j.RunMethod("buttonSettings", CreateMap("width":120, "height":40,"theme":"light","value":"button"))
Dim j As BANanoObject = BANano.Window.GetField("JQXElements").GetField("settings")
j.SetField("buttonSettings", CreateMap("width":120, "height":40,"theme":"light","value":"button"))
untested:
B4X:j.RunMethod("settings", Array("buttonSettings", CreateMap("width":120, "height":40,"theme":"light","value":"button")))
Untested, but try this:
B4X:Dim j As BANanoObject = BANano.Window.GetField("JQXElements").GetField("settings") j.SetField("buttonSettings", CreateMap("width":120, "height":40,"theme":"light","value":"button"))