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

23
LINES

< > BotCompany Repo | #1017125 // bindCheckBoxToLiveValue

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

Libraryless. Click here for Pure Java version (6416L/36K).

1  
meta-for SimpleLiveValue also as IVarWithNotify {
2  
  static <A extends JCheckBox> A bindCheckBoxToLiveValue(A cb, SimpleLiveValue<Bool> lv) {
3  
    bindChangeListenerToComponent(cb, lv, r {
4  
      ifdef bindCheckBoxToLiveValue_debug
5  
        print("bindCheckBoxToLiveValue: setting " + isTrue(lv!));
6  
      endifdef
7  
      setChecked(cb, isTrue(lv!));
8  
      ifdef bindCheckBoxToLiveValue_debug
9  
        print("bindCheckBoxToLiveValue: setting done");
10  
      endifdef
11  
    });
12  
    onChange(cb, r {
13  
      ifdef bindCheckBoxToLiveValue_debug
14  
        print("bindCheckBoxToLiveValue: setting 2: " + isChecked(cb));
15  
      endifdef
16  
      lv.set(isChecked(cb));
17  
      ifdef bindCheckBoxToLiveValue_debug
18  
        print("bindCheckBoxToLiveValue: setting 2 done");
19  
      endifdef
20  
    });
21  
    ret cb;
22  
  }
23  
}

Author comment

Began life as a copy of #1016619

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1017125
Snippet name: bindCheckBoxToLiveValue
Eternal ID of this version: #1017125/6
Text MD5: 15b4a409cefd49f99fcaecf2c816065b
Transpilation MD5: d051dfba37cef3aa0f3c813858b19221
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-03-17 17:16:01
Source code size: 806 bytes / 23 lines
Pitched / IR pitched: No / No
Views / Downloads: 399 / 541
Version history: 5 change(s)
Referenced in: [show references]