Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Understanding multi dimensional arrays
#1
I am trying to understand multi dimension arrays. I am trying to draw a box on a dialog or in a RTF. I think that this would be a four dimensional array that the user can put in the size of the array and press a button and the box will be drawn. I would also like for the array to be changed on the fly by dragging the lines on the RTF to a new position. Can this be done?

Examples:

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

str controls = "3 5 6 7 8"
str rea3 e5 e6 e7 e8
if(!ShowDialog("Box_Array" &Box_Array &controls)) ret

;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 223 135 "Dialog"
;1 Button 0x54030001 0x4 120 116 48 14 "OK"
;2 Button 0x54030000 0x4 170 116 48 14 "Cancel"
;3 RichEdit20A 0x54233044 0x200 0 26 222 86 ""
;4 Button 0x54032000 0x0 170 2 48 14 "Create Array"
;5 Edit 0x54032000 0x200 8 2 32 14 ""
;6 Edit 0x54032000 0x200 58 2 32 14 ""
;7 Edit 0x54032000 0x200 6 118 32 14 ""
;8 Edit 0x54032000 0x200 56 118 32 14 ""
;9 Static 0x54000000 0x0 2 2 48 12 "1"
;10 Static 0x54000000 0x0 52 2 48 12 "2"
;11 Static 0x54000000 0x0 50 118 48 12 "4"
;12 Static 0x54000000 0x0 0 118 48 12 "3"
;END DIALOG
;DIALOG EDITOR: "" 0x2030005 "" "" ""

ret
;messages
sel message
,case WM_INITDIALOG
,ARRAY(int) a ;;declare array of integers
,a.create(4 1) ;;create array of four dimensions, one element in each
,str x1 y1 x2 y2
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case 4
,;set elements
,x1.getwintext(id(5 win("Dialog" "#32770")))
,y1.getwintext(id(6 win("Dialog" "#32770")))
,x2.getwintext(id(7 win("Dialog" "#32770")))
,y2.getwintext(id(8 win("Dialog" "#32770")))
,// I guess that this would be draw lines to the four points of the array
,// I do not have a clue on how to drag the lines to expand the array
,case IDOK
,case IDCANCEL
ret 1

   
#2
Why 4-dim array needed to draw a rectangle?
#3
My assumption was a 4-dim array was needed.


Forum Jump:


Users browsing this thread: 1 Guest(s)