yawoo Posted August 7, 2008 Share Posted August 7, 2008 I would like to write a ListBox with UP and DOWN button to move the selected item going up and down. The code is worked for plain ASCII lists. But if the list item contains chinese characters, the chinese characters will be trimed about two characters each move, as shown in screenshots. It seems that the UDF code is still not worked for non-plain ASCII characters yet. Any workaround solution? Thx a lot. CODE Case $iMsg = $hBatchUp $i = _GUICtrlListBox_GetCurSel($hBatch) If $i > 0 Then _GUICtrlListBox_SwapString($hBatch, $i-1, $i) _GUICtrlListBox_SetCurSel($hBatch, $i-1) EndIf Case $iMsg = $hBatchDown $i = _GUICtrlListBox_GetCurSel($hBatch) If $i <> -1 Then _GUICtrlListBox_SwapString($hBatch, $i+1, $i) _GUICtrlListBox_SetCurSel($hBatch, $i+1) EndIf Link to comment Share on other sites More sharing options...
yawoo Posted August 7, 2008 Author Share Posted August 7, 2008 (edited) It seems that _GUICtrlListBox_GetText cannot return the chinese string properly. Here is my solution, it use GUICtrlRead to retrieve the list string instead of. CODE Case $iMsg = $hBatchUp $i = _GUICtrlListBox_GetCurSel($hBatch) If $i > 0 Then $s = GUICtrlRead($hBatch) _GUICtrlListBox_SetCurSel($hBatch, $i-1) _GUICtrlListBox_ReplaceString($hBatch, $i, GUICtrlRead($hBatch)) _GUICtrlListBox_ReplaceString($hBatch, $i-1, $s) _GUICtrlListBox_SetCurSel($hBatch, $i-1) EndIf Case $iMsg = $hBatchDown $i = _GUICtrlListBox_GetCurSel($hBatch) If $i <> -1 Then $s = GUICtrlRead($hBatch) _GUICtrlListBox_SetCurSel($hBatch, $i+1) _GUICtrlListBox_ReplaceString($hBatch, $i, GUICtrlRead($hBatch)) _GUICtrlListBox_ReplaceString($hBatch, $i+1, $s) _GUICtrlListBox_SetCurSel($hBatch, $i+1) EndIf Edited August 7, 2008 by yawoo Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now