Browse Source

add dropbox sample

Roman Dayneko 11 years ago
parent
commit
e0bed066b1
1 changed files with 8 additions and 4 deletions
  1. 8 4
      apps/face/src/index.erl

+ 8 - 4
apps/face/src/index.erl

@@ -21,7 +21,12 @@ body() ->
       #button{ id = attach, body = <<"Attach">>, postback = attach},
       #button{ id = attach, body = <<"Attach">>, postback = attach},
       #button{ id = join, body = <<"Join">>, postback = join},
       #button{ id = join, body = <<"Join">>, postback = join},
       #button{ id = take, body = <<"Take">>, postback = take},
       #button{ id = take, body = <<"Take">>, postback = take},
-      #textbox{ id = tbcolor }, #textbox{ id = tbvalue }, #button{ id = discard, body = <<"Discard">>, postback = discard, source = [tbcolor, tbvalue]}
+      #select { id=dropdown1, value="2", options=[
+                                                    #option { body="Option 1", value="1" },
+                                                    #option { body="Option 2", value="2" },
+                                                    #option { body="Option 3", value="3" }
+                                                   ]},
+      #button{ id = discard, body = <<"Discard">>, postback = discard}
     ].
     ].
 
 
 event(init) ->
 event(init) ->
@@ -67,13 +72,12 @@ event(take) ->
 
 
 
 
 event(discard) ->
 event(discard) ->
-    Color = wf:q(tbcolor),
-    Value = wf:q(tbvalue),
+    Color = "1", %%wf:q(cardcolor),
+    Value = "1", %%wf:q(cardvalue),
     Msg = "ws.send(Bert.encodebuf(Bert.tuple(Bert.atom('client'),"
     Msg = "ws.send(Bert.encodebuf(Bert.tuple(Bert.atom('client'),"
         " Bert.tuple(Bert.atom('game_action'), 1000001, Bert.atom('okey_discard')," 
         " Bert.tuple(Bert.atom('game_action'), 1000001, Bert.atom('okey_discard')," 
         " [Bert.tuple(Bert.atom('tile'), Bert.tuple(Bert.atom('OkeyPiece'), " ++ Color ++ ", " ++ Value ++ "))]) )));",
         " [Bert.tuple(Bert.atom('tile'), Bert.tuple(Bert.atom('OkeyPiece'), " ++ Color ++ ", " ++ Value ++ "))]) )));",
     wf:wire(Msg);
     wf:wire(Msg);
 
 
-
 event(Event) -> wf:info("Event: ~p", [Event]).
 event(Event) -> wf:info("Event: ~p", [Event]).