Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

46
LINES

< > BotCompany Repo | #1020308 // List Maker [dev.]

JavaX source code (Dynamic Module) [tags: use-pretranspiled] - run with: Stefan's OS

Libraryless. Click here for Pure Java version (18072L/133K).

1  
!7
2  
3  
concept AList {
4  
  S name, comment;
5  
  Int length; // if known
6  
  long lastChanged;
7  
  
8  
  // All other fields are dynamic (in fieldValues).
9  
}
10  
11  
sclass ListMaker > DynCRUD<AList> {
12  
  bool voiceMode = true;
13  
  
14  
  *() { super(AList); }
15  
  
16  
  start {
17  
    dm_onTopInput(voidfunc(S s) { if (voiceMode) reactToInput(s) });
18  
  }
19  
  
20  
  void reactToInput(fS s) {
21  
    switch to dm_q();
22  
    if (matchEnd_vbar("new list", s))
23  
      addDialog();
24  
  }
25  
  
26  
  void addDialog enter {
27  
    dm_say("Making a list");
28  
    final JTextField tfName = jTextField();
29  
    dm_callModule(dm_voiceTargetsModule(), 'addVoiceTarget, dm_moduleID(), tfName, func(S s) -> bool {
30  
      if "cancel" ret true with disposePIFrame(tfName);
31  
      false;
32  
    });
33  
    showFormTitled("Name for new list",
34  
      "Name", tfName, r {
35  
        name = or2(gtt(tfName), "A list made on " + ymd_hms());
36  
        cnew(AList, +name, lastChanged := now());
37  
      });
38  
    dm_say("What should it be called?");
39  
  }
40  
  
41  
  visualize {
42  
    ret northAndCenter(
43  
      withMargin(dm_fieldCheckBox('voiceMode)),
44  
      super.visualize());
45  
  }
46  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 8 computer(s): bhatertpkbcr, cfunsshuasjs, gwrvuhgaqvyk, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1020308
Snippet name: List Maker [dev.]
Eternal ID of this version: #1020308/12
Text MD5: dfa235cbac73dd40e0ccd8da6d64ae8f
Transpilation MD5: c70d84f52e50f9add27cebea7f2e27ff
Author: stefan
Category: javax / stefan's os
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-12-14 00:25:45
Source code size: 1112 bytes / 46 lines
Pitched / IR pitched: No / No
Views / Downloads: 229 / 1667
Version history: 11 change(s)
Referenced in: [show references]