Quantcast
Channel: OKWAVE 最新質問([技術者向] コンピューター/205)【本日】
Viewing all articles
Browse latest Browse all 38062

google apps script TextAr

$
0
0
ラジオボタンをクリックしたとき、一番下のテキストエリアを一瞬光らせるにはどうすればよいでしょうか。 実際には、色がついてすぐに消えることをイメージしています。 スプレッドシートには、範囲名として、bdy1,bdy2,bdy3が登録されています。 よろしくお願いします。 var body; var w, h, txt; var spaces = "______________________________________________________"; var spPad = spaces.length; var rdNums = 4; function UiTest() { var Ssh = SpreadsheetApp.getActiveSpreadsheet(); var sheet = SpreadsheetApp.getActiveSheet(); var app = UiApp.createApplication().setHeight(700).setWidth(420); var panel = app.createFlowPanel(); app.add(panel); w = app.createTextBox(); w.setName("sel_group1").setId("sel_group1"); w.setVisible(false); w.setText("0"); panel.add(w); for (var ss, i = 0; i < rdNums; i++) { ss = "radio" + i; w = app.createRadioButton("group1").setName(ss).setId(ss); if (i == 0) w.setValue(true); h = app.createServerChangeHandler(ss); w.addClickHandler(h); h.addCallbackElement(panel); txt = getPartOffsetByNameTtl("bdy2", i); txt = txt.length < spPad ? (txt + spaces).substring(0, spPad) : txt; w.setText(txt); panel.add(w); ss = "ta" + i; w = app.createTextArea().setName(ss).setId(ss); w.setSize(420, 70); txt = getPartOffsetByName("bdy2", i); w.setText(txt); panel.add(w); } w = app.createLabel("label3"); w.setStyleAttribute("background-color", "#ffaa55"); w.setStyleAttribute("color", "#ffffff"); w.setStyleAttribute("font-size", "18pt"); w.setStyleAttribute("text-align", "center"); w.setText("【返信用全文】"); panel.add(w); w = app.createTextArea().setName('taReturn').setId('taReturn'); w.setSize(420, 700); w.setText(getBody(0)); h = app.createServerHandler('onTaReturn'); w.addFocusHandler(h); h.addCallbackElement(panel); panel.add(w); Ssh.show(app); return app; } function getBody(ofst) { var header = "header\n"; body = header; body += getPartOffsetByName("bdy2", ofst) + "\n"; body += getPartByName("bdy3") + "\n"; return body; } function getPartByName(cell) { var Ssh = SpreadsheetApp.getActiveSpreadsheet(); return Ssh.getRangeByName(cell).getValue(); } function getPartOffsetByName(cell, ofst) { var Ssh = SpreadsheetApp.getActiveSpreadsheet(); return Ssh.getRangeByName(cell).offset(ofst, 0).getValue(); } function getPartOffsetByNameTtl(cell, ofst) { var Ssh = SpreadsheetApp.getActiveSpreadsheet(); return Ssh.getRangeByName(cell).offset(ofst, -1).getValue(); } function setRadio(app, rdNo, e) { var oldNo = e.parameter.sel_group1; if (rdNo != oldNo) app.getElementById('radio' + oldNo).setValue(false); app.getElementById("sel_group1").setText(rdNo); app.getElementById('taReturn').setText(getBody(rdNo)); return app; } function radio0(e) { var app = UiApp.getActiveApplication(); setRadio(app, '0', e); return app; } function radio1(e) { var app = UiApp.getActiveApplication(); setRadio(app, '1', e); return app; } function radio2(e) { var app = UiApp.getActiveApplication(); setRadio(app, '2', e); return app; } function radio3(e) { var app = UiApp.getActiveApplication(); setRadio(app, '3', e); return app; } function onTaReturn(e) { var app = UiApp.getActiveApplication(); w = app.getElementById("taReturn"); w.setSelectionRange(0, e.parameter.taReturn.length); return app; }

Viewing all articles
Browse latest Browse all 38062


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>