# Coding 奇難雜症

**URL:** <https://forum.wise-paas.advantech.com/t/coding/740>\
**Category:** SaaSComposer\
**Created:** [September 4, 2024, 7:02am UTC](https://forum.wise-paas.advantech.com/t/coding/740 "2024-09-04T07:02:59Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![Elina\_Liu](https://avatars.discourse-cdn.com/v4/letter/e/43a26b/32.png) [@Elina\_Liu](https://forum.wise-paas.advantech.com/u/Elina_Liu)\
**Post date:** [October 15, 2024, 7:27am UTC](https://forum.wise-paas.advantech.com/t/coding/740/7 "2024-10-15T07:27:16Z")

</div>

@Chien_Wei_Hiew 您好，

1. 關於彈出視窗實作方法可以參考這篇討論：[How to create pop out screen for control in 3D format?](https://forum.wise-paas.advantech.com/t/how-to-create-pop-out-screen-for-control-in-3d-format/684)

2. 關於 2D 物件顏色改變以及 Event Handler 配置可以參考這篇技術文檔：[Interactive Background Color Change on Mouse Down Event](https://docs.wise-paas.advantech.com/zh-tw/Guides_and_API_References/ApplicationServices/SaaS_Composer/1596779559407479299/v1.0.1)

3. 關於 EdgeHub 數值的反向控制實作，我們建議可以新增一個 Text 物件用來呈現數值，另外新增一個 Button，透過點擊 Button 讓 EdgeHub 數值進行遞增，具體操作參考如下：  
(1) 首先新增一個 Text 綁定 EdgeHub datasource，並命名 Text 的 tag 標簽，此範例命名為 “text1”；新增一個 Button 並勾選 Events Interactive。  
(2) 開啟 Button Event Handler 視窗選擇 Click event，輸入var currvalue = dataModel.getDataByTag(“text1”).s(‘text’); 以取得當前的 value 加 1 作為 target value，dataRefreshUtil.setValue function 來反向寫入 target value 作為 EdgeHub 的新數值，以下是範例程式：

> // 取得當前 value  
> var currvalue = dataModel.getDataByTag(“text1”).s(‘text’);
> 
> // parseInt() 確保為整數資料型態  
> var target = parseInt(currvalue ) + 1;
> 
> //反向控制 EdgeHub data  
> dataRefreshUtil.setValue(“EdgeHub data source”,“ene-simple-json-datasource”,{  
> “target” : “12#92#|lat”,  
> “value” : target}

 ![image](https://canada1.discourse-cdn.com/flex032/uploads/wisepaasforum/original/1X/1f1812a53c27bed6271015c3981cbf010661eb69.png)

 ![image](https://canada1.discourse-cdn.com/flex032/uploads/wisepaasforum/original/1X/c4a4705578adf53d8c15d003a5740a668f5fc5a6.png)

---

_[View the full topic](https://forum.wise-paas.advantech.com/t/coding/740)._
