CREATE NConv_Form AS QFORM
BorderStyle = bsDialog
Visible = 0
Height = 125
Width = 270
CAPTION = "Number Bases (Achilles B. Mina)"
COLOR = 16777215
Center
KeyPreview = 1
OnKeyPress = NConv_FormKeyPress
CREATE NConv_DecimalEd AS QEDIT
Top = 10
Left = 10
Width = 150
COLOR = RGB(255 , 255 , 237)
OnChange = ConvertNum
END CREATE
CREATE NConv_DecimalButt AS QCOOLBTN
Top = 10
Left = 165
Width = 22
Height = 22
BMPHandle = paste_BMP
Hint = "Paste decimal value"
Flat = 1
Layout = 4
Cursor = - 21
ShowHint = 1
OnClick = InsertNum
END CREATE
CREATE NConv_DecimalLabel AS QLABEL
Height = 22
Width = 40
Top = 15
Left = 190
Layout = 1
CAPTION = "Decimal"
END CREATE
CREATE NConv_HexEd AS QEDIT
Top = 38
Left = 10
Width = 150
COLOR = RGB(255 , 255 , 237)
OnChange = ConvertNum
END CREATE
CREATE NConv_HexButt AS QCOOLBTN
Top = 38
Left = 165
Width = 22
Height = 22
BMPHandle = paste_BMP
Hint = "Paste hexadecimal value"
Flat = 1
Cursor = - 21
ShowHint = 1
OnClick = InsertNum
END CREATE
CREATE NConv_HexLabel AS QLABEL
Height = 22
Width = 40
Top = 43
Left = 190
Layout = 1
CAPTION = "Hexadecimal"
END CREATE
CREATE NConv_BinaryEd AS QEDIT
Top = 66
Left = 10
Width = 150
COLOR = RGB(255 , 255 , 237)
OnChange = ConvertNum
END CREATE
CREATE NConv_BinaryButt AS QCOOLBTN
Top = 66
Left = 165
Width = 22
Height = 22
BMPHandle = paste_BMP
Hint = "Paste binary value"
Flat = 1
Layout = 4
Cursor = - 21
ShowHint = 1
OnClick = InsertNum
END CREATE
CREATE NConv_BinaryLabel AS QLABEL
Height = 71
Width = 40
Top = 71
Left = 190
Layout = 1
CAPTION = "Binary"
END CREATE
END CREATE
SUB ConvertNum(Sender AS QEDIT)
SELECT CASE Sender.Handle
CASE NConv_DecimalEd.Handle
NConv_HexEd.Text = CONVBASE$(NConv_DecimalEd.Text , 10 , 16)
NConv_BinaryEd.Text = CONVBASE$(NConv_DecimalEd.Text , 10 , 2)
CASE NConv_HexEd.Handle
NConv_DecimalEd.Text = CONVBASE$(NConv_HexEd.Text , 16 , 10)
NConv_BinaryEd.Text = CONVBASE$(NConv_HexEd.Text , 16 , 2)
CASE NConv_BinaryEd.Handle
NConv_HexEd.Text = CONVBASE$(NConv_BinaryEd.Text , 2 , 16)
NConv_DecimalEd.Text = CONVBASE$(NConv_BinaryEd.Text , 2 , 10)
END SELECT
END SUB
SUB InsertNum(Sender AS QCOOLBTN)
DEFSTR TxtToAdd = ""
SELECT CASE Sender.Handle
CASE NConv_DecimalButt.Handle
TxtToAdd = NConv_DecimalEd.Text
CASE NConv_HexButt.Handle
TxtToAdd = "&H" + NConv_HexEd.Text
CASE NConv_BinaryButt.Handle
TxtToAdd = NConv_BinaryEd.Text
END SELECT
re.AddStrings TxtToAdd
END SUB
SUB NConv_Show
NConv_Form.SHOWMODAL
END SUB
SUB NConv_FormKeyPress(theKey AS BYTE)
IF theKey = 27 THEN NConv_Form.CLOSE
END SUB
|