SlideShare a Scribd company logo
物件的值莫名奇妙被改掉
星期四, 2月 21, 2013
問題描述
1. 選取白色9點、按下「>>」(add)
2. 在右邊的List,任意選取特定數字3個(可不連續),按下「<<」
(delete)
3. 最後List呈現的卻是從後面刪除選取數目
單一筆資料物件
Sequence: 2, AreaCode: 2, Point(227, 128), BkColor(255, 255, 255), BeHaveData(1), 2013/3/1, 11:11:55
量測日期、時間
該點是否有值
背景顏色
點座標
區域順序
量測順序
問題描述
藍色為最終結果
白色為被刪除掉的部份
黑框為被選取的項目
程式記錄檔可以看見,資料的確被刪除,但是物件本身的
資料卻變得和原本的不一樣
Debug
Debug
A
compA
Debug
程式記錄檔
第一步新增出來的陣列(位址、顏色、點)
19D586C, c(255, 255, 255), P(227, 128) ←begin
19D58E0, c(255, 255, 255), P(683, 128)
19D5954, c(255, 255, 255), P(1139, 128)
19D59C8, c(255, 255, 255), P(227, 384)
19D5A3C, c(255, 255, 255), P(683, 384)
19D5AB0, c(255, 255, 255), P(1139, 384)
19D5B24, c(255, 255, 255), P(227, 640)
19D5B98, c(255, 255, 255), P(683, 640)
19D5C0C, c(255, 255, 255), P(1139, 640)
19D5C80 ←end
選取的項目新增的另一個陣列(位址不同)
19F8314, c(255, 255, 255), P(683, 384)
19F8388, c(255, 255, 255), P(1139, 384)
19F83FC, c(255, 255, 255), P(227, 640)
由此可確定,OnButtonDel()程式碼的虛線以上是沒問題的!
的確有選取到想選取的資料。
接下來看看,虛線以下的部份,這部份主要就看兩個函式CutEqualCell()
和ListBoxUpdate()
Debug
A
compA
CutEqualCell()----(1)
ListBoxUpdate()---(2)
Debug
(1)
Debug
removeIter由init之後,執行一
次std::remove()而移動一次;藍
底項目為卻刪除的項目,紅框的
部份可對照下圖,成功的保留下
來。
執行完delete button之後的結果,
是正確想要的?!
Debug
這只是重新將std::vector<>的內容增加到List而已,並沒有什麼特別的。
(2)
那問題在哪裡??
到目前為止,Debug的結果是
delete button的動作是沒問題的
但是有一個地方有疑點
std::remove()的使用注意事項。
STL的演算法
在使用STL的演算法時
需注意物件重載的運算子。
自行定義
運算的符號
Debug
量測順序
區域順序
點座標
背景顏色
量測數據的資料
量測日期、時間
Debug
這個物件只要顏色和位置相同,就視為相同!
量測順序→由顏色和點所判斷產生
區域順序→由顏色和點所判斷產生
點座標
背景顏色
量測數據的資料→絕對不會完全相同
量測日期、時間→絕對不會完全相同
Debug
量測順序→要複製
區域順序→要複製
點座標
背景顏色
量測數據的資料
量測日期、時間→也要複製
Debug
量測順序
區域順序
點座標
背景顏色
量測數據的資料
量測日期、時間

More Related Content

More from Chris Wang

MVC Design in Web backend Server
MVC Design in Web backend ServerMVC Design in Web backend Server
MVC Design in Web backend Server
Chris Wang
 
Bug afx ini-line122
Bug afx ini-line122Bug afx ini-line122
Bug afx ini-line122
Chris Wang
 
VC6 font setup tips
VC6 font setup tipsVC6 font setup tips
VC6 font setup tips
Chris Wang
 
MFC tips for single document
MFC tips for single documentMFC tips for single document
MFC tips for single document
Chris Wang
 
CString of MFC skills
CString of MFC skillsCString of MFC skills
CString of MFC skills
Chris Wang
 
應用於液晶電視中動態背光調光技術之演算法與系統整合實現 論文口試投影片
應用於液晶電視中動態背光調光技術之演算法與系統整合實現 論文口試投影片應用於液晶電視中動態背光調光技術之演算法與系統整合實現 論文口試投影片
應用於液晶電視中動態背光調光技術之演算法與系統整合實現 論文口試投影片
Chris Wang
 
偷偷學習 Python3
偷偷學習 Python3偷偷學習 Python3
偷偷學習 Python3
Chris Wang
 
思考 Vuex 發送 API 的架構
思考 Vuex 發送 API 的架構思考 Vuex 發送 API 的架構
思考 Vuex 發送 API 的架構
Chris Wang
 
從 Flux 認識 vuex
從 Flux 認識 vuex從 Flux 認識 vuex
從 Flux 認識 vuex
Chris Wang
 
Information architecture reading ch7
Information architecture reading ch7Information architecture reading ch7
Information architecture reading ch7
Chris Wang
 
用Vue改dom
用Vue改dom用Vue改dom
用Vue改dom
Chris Wang
 
Cppunit下載、編譯、使用與困難排除
Cppunit下載、編譯、使用與困難排除Cppunit下載、編譯、使用與困難排除
Cppunit下載、編譯、使用與困難排除
Chris Wang
 
如何寫好程式
如何寫好程式如何寫好程式
如何寫好程式
Chris Wang
 
迷路的浪漫
迷路的浪漫迷路的浪漫
迷路的浪漫
Chris Wang
 
Win32 api看視窗運作
Win32 api看視窗運作Win32 api看視窗運作
Win32 api看視窗運作
Chris Wang
 

More from Chris Wang (15)

MVC Design in Web backend Server
MVC Design in Web backend ServerMVC Design in Web backend Server
MVC Design in Web backend Server
 
Bug afx ini-line122
Bug afx ini-line122Bug afx ini-line122
Bug afx ini-line122
 
VC6 font setup tips
VC6 font setup tipsVC6 font setup tips
VC6 font setup tips
 
MFC tips for single document
MFC tips for single documentMFC tips for single document
MFC tips for single document
 
CString of MFC skills
CString of MFC skillsCString of MFC skills
CString of MFC skills
 
應用於液晶電視中動態背光調光技術之演算法與系統整合實現 論文口試投影片
應用於液晶電視中動態背光調光技術之演算法與系統整合實現 論文口試投影片應用於液晶電視中動態背光調光技術之演算法與系統整合實現 論文口試投影片
應用於液晶電視中動態背光調光技術之演算法與系統整合實現 論文口試投影片
 
偷偷學習 Python3
偷偷學習 Python3偷偷學習 Python3
偷偷學習 Python3
 
思考 Vuex 發送 API 的架構
思考 Vuex 發送 API 的架構思考 Vuex 發送 API 的架構
思考 Vuex 發送 API 的架構
 
從 Flux 認識 vuex
從 Flux 認識 vuex從 Flux 認識 vuex
從 Flux 認識 vuex
 
Information architecture reading ch7
Information architecture reading ch7Information architecture reading ch7
Information architecture reading ch7
 
用Vue改dom
用Vue改dom用Vue改dom
用Vue改dom
 
Cppunit下載、編譯、使用與困難排除
Cppunit下載、編譯、使用與困難排除Cppunit下載、編譯、使用與困難排除
Cppunit下載、編譯、使用與困難排除
 
如何寫好程式
如何寫好程式如何寫好程式
如何寫好程式
 
迷路的浪漫
迷路的浪漫迷路的浪漫
迷路的浪漫
 
Win32 api看視窗運作
Win32 api看視窗運作Win32 api看視窗運作
Win32 api看視窗運作
 

物件的值莫名奇妙被改掉