08-19-2008, 08:05 AM
Figured out the 8-bit binary...it's not too hard really
Function Convert_to_Binary
Function Convert_to_Binary
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages
;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 90 65 "8-Bit Binary"
;2 Button 0x54030000 0x4 44 46 40 14 "Close"
;3 Edit 0x54030080 0x200 4 10 80 14 ""
;4 Edit 0x54030080 0x200 4 26 10 14 ""
;5 Edit 0x54030080 0x200 14 26 10 14 ""
;6 Edit 0x54030080 0x200 24 26 10 14 ""
;7 Edit 0x54030080 0x200 34 26 10 14 ""
;8 Edit 0x54030080 0x200 44 26 10 14 ""
;9 Edit 0x54030080 0x200 54 26 10 14 ""
;10 Edit 0x54030080 0x200 64 26 10 14 ""
;11 Edit 0x54030080 0x200 74 26 10 14 ""
;12 Button 0x54032000 0x0 4 46 40 14 "Convert"
;END DIALOG
;DIALOG EDITOR: "" 0x2030001 "" "" ""
str controls = "3 4 5 6 7 8 9 10 11"
str e3 e4 e5 e6 e7 e8 e9 e10 e11
e3=0
e4=0
e5=0
e6=0
e7=0
e8=0
e9=0
e10=0
e11=0
if(!ShowDialog("Convert_to_Binary" &Convert_to_Binary &controls)) ret
ret
;messages
sel message
,case WM_INITDIALOG
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case 12
,int Source=id(3 win("8-Bit Binary" "#32770"))
,int b1=id(4 win("8-Bit Binary" "#32770"))
,str s
,int b
,str ss.getwintext(Source)
,int S=val(ss)
,if S>255
,,mes "8-bit binary cannot excede 255" "8-bit Binary" "!"
,,ret
,CURRENCY i i0 i1 i2
,i=4
,i0=S
,rep 8
,,i0.div(i0 2)
,,i1.round(i0)
,,i2.sub(i0 i1)
,,if i2=0
,,,s=0
,,,out s
,,,s.setwintext(id(i win("8-Bit Binary" "#32770")))
,,,i=i+1
,,else
,,,i0.sub(i0 0.5)
,,,s=1
,,,out s
,,,s.setwintext(id(i win("8-Bit Binary" "#32770")))
,,,i=i+1
,case IDOK
,case IDCANCEL
ret 1