1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
define.class(function(require, $ui$, view, label, button, scrollbar, textbox, icon){
this.attributes={
searchtextlabel:"search",
fontsize: 12,
value:""
}
this.margin = 4
this.bgcolor="#3b3b3b"
this.flexdirection = "row";
this.bordercolor = "#505050" ;
this.borderwidth = 2;
this.borderradius = 5;
this.dofocus = function(){
var tb = this.findChild("thetext");
if (tb){
if (tb.focus){
this.find("thelabel").visible = false;
}
else{
if (this.value.trim() == ""){
this.find("thelabel").visible = true;
}
else{
this.find("thelabel").visible = false;
}
}
}
}
this.justifycontent= "center"
this.focus = function(){
if(this._focus) this.find("thetext").focus = true
}
this.render = function(){
return [
textbox({
multiline:false,
borderradius:15,
name:"thetext",
value:function(){
this.parent.value = this.value
},
flex:1,
bgcolor:"#3b3b3b",
fgcolor: "white",
focus: function(){
this.dofocus()
}.bind(this)
}),
label({name:"thelabel",position:"absolute",margin:7, text:this.searchtextlabel,fontsize:this.fontsize, bgcolor:NaN, fgcolor:"#707070"}),
icon({icon:"search", margin:6, fgcolor:"#707070", alignself:"center"})]
}
})
|