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

21
LINES

< > BotCompany Repo | #1028019 // jCheckBoxMenuItem_dyn - with lambda getting value on show

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (5004L/28K).

1  
// IMPORTANT: doesn't work with JTattoo (so not currently in Stefan's OS). listeners are only called on first show+hide
2  
// r : runnable or voidfunc(bool)
3  
static JCheckBoxMenuItem jCheckBoxMenuItem_dyn(S text, IF0<Bool> checked, O r) {
4  
  JCheckBoxMenuItem mi = jCheckBoxMenuItem(text, false, r);
5  
  if (checked != null) bindToComponent(mi, r {
6  
    bool b = isTrue(checked!);
7  
    ifdef jCheckBoxMenuItem_dyn_debug
8  
      print("jCheckBoxMenuItem_dyn: " + b + " " + text);
9  
    endifdef
10  
    setChecked(mi, b);
11  
  }, r {
12  
    ifdef jCheckBoxMenuItem_dyn_debug
13  
      print("jCheckBoxMenuItem_dyn: hiding " + text);
14  
    endifdef
15  
  });
16  
  ret mi;
17  
}
18  
19  
static JCheckBoxMenuItem jCheckBoxMenuItem_dyn(S text, IF0<Bool> checked, IVF1<Bool> r) {
20  
  ret jCheckBoxMenuItem_dyn(text, checked, (O) r);
21  
}

Author comment

Began life as a copy of #1006523

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1028019
Snippet name: jCheckBoxMenuItem_dyn - with lambda getting value on show
Eternal ID of this version: #1028019/9
Text MD5: d6f8ae28370ba505d71c1202ae5d598d
Transpilation MD5: 41807a1cf44bbb964888caa9cd0fba65
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-11-03 12:57:52
Source code size: 801 bytes / 21 lines
Pitched / IR pitched: No / No
Views / Downloads: 249 / 361
Version history: 8 change(s)
Referenced in: [show references]