Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Simpler code
#1
Is it possible to do this of simpler way?

Code:
Copy      Help
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages

str controls = "3"
str lb3
ARRAY(int)+ ihwnd=0
GetWindowList(lb3 0 7 0 0 ihwnd)
if(!ShowDialog("reordenar" &reordenar &controls)) ret

;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 255 248 "Form"
;1 Button 0x54030001 0x4 150 230 48 14 "OK"
;2 Button 0x54030000 0x4 202 230 48 14 "Cancel"
;3 ListBox 0x54230101 0x200 24 18 172 172 ""
;4 Button 0x54032000 0x0 200 18 48 14 "ARRIBA"
;5 Button 0x54032000 0x0 200 38 48 14 "ABAJO"
;6 Button 0x54032000 0x0 92 194 48 14 "Reorganizar"
;END DIALOG
;DIALOG EDITOR: "" 0x2010808 "" ""


ret
;messages
if(message=WM_INITDIALOG) DT_Init(hDlg lParam)
;int param=DT_GetParam(hDlg)

sel message
,case WM_INITDIALOG
,ret 1
,case WM_DESTROY DT_DeleteData(hDlg)
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case 6
,for _i 0 ihwnd.len
,,taskbar_AD 2 ihwnd[_i]
,for _i 0 ihwnd.len
,,taskbar_AD 1 ihwnd[_i]
,case 5
,int c i cc ii=id(3 hDlg)
,str a
,i=LB_GetCount(ii)
,;out i
,for c 0 i
,,LB_GetItemText(ii c _s)
,,a.formata("%s[]" _s)
,_i=LB_SelectedItem(ii)
,intercambia_linea(a _i _i+1)
,intercambia(ihwnd[_i] ihwnd[_i+1])
,TO_CBFill(ii a 1)
,LB_SelectItem(ii _i+1)
,case 4
,ii=id(3 hDlg)
,i=LB_GetCount(ii)
,for c 0 i
,,LB_GetItemText(ii c _s)
,,a.formata("%s[]" _s)
,_i=LB_SelectedItem(ii)
,intercambia_linea(a _i _i-1)
,intercambia(ihwnd[_i] ihwnd[_i-1])
,TO_CBFill(ii a 1)
,LB_SelectItem(ii _i-1)
,case IDOK DT_Ok hDlg
,case IDCANCEL DT_Cancel hDlg
ret 1


Forum Jump:


Users browsing this thread: 1 Guest(s)