Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Case "box"
- Local $lastXY = _Console_GetCursorXY()
- Switch $aWords[0]
- Case 1
- _Console_Pause("Błąd w linii: " & $iLine & ", brak 6 parametrów polecenia box - poz:x poz:y rozm:x rozm:y tytuł elementy")
- Exit
- Case 2
- _Console_Pause("Błąd w linii: " & $iLine & ", brak 5 parametrów polecenia box - poz:y rozm:x rozm:y tytuł elementy")
- Exit
- Case 3
- _Console_Pause("Błąd w linii: " & $iLine & ", brak 4 parametrów polecenia box - rozm:x rozm:y tytuł elementy")
- Exit
- Case 4
- _Console_Pause("Błąd w linii: " & $iLine & ", brak 3 parametrów polecenia box - rozm:y tytuł elementy")
- Exit
- Case 5
- _Console_Pause("Błąd w linii: " & $iLine & ", brak 2 parametrów polecenia box - tytuł elementy")
- Exit
- Case 6
- _Console_Pause("Błąd w linii: " & $iLine & ", brak 1 parametrów polecenia box - elementy")
- Exit
- Case Else
- Local $inpSet = "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM1234567890!@#$%^&*()[]{};:'" & '"' & ",<.>?`~-_=+\"
- Local $iCode = "", $cChar = ""
- Local $pX = $aWords[2], $pY = $aWords[3], $rX = $aWords[4], $rY = $aWords[5]
- Local $aSplit = StringSplit($aWords[7], ";"), $szTitle = $aWords[6]
- Local $element[$aSplit[0]][6], $iButtons = 0, $iInps = 0, $inpSel = 0
- Local $iMouse[3] = [0, 0, 0]
- _Console_Fill($pX, $pY, $rX, 1, "9F", " ")
- _Console_Fill($pX + _Box_Center($rX, $szTitle), $pY, StringLen(StringLeft($szTitle, $rX)), 1, "9F", $szTitle)
- _Console_Fill($pX, $pY + 1, $rX, $rY - 1, "FF", " ")
- For $iLines = 1 To $aSplit[0]
- If StringLeft($aSplit[$iLines], 2) = "##" Then
- If _Box_ParseLine($aSplit[$iLines], "x") + StringLen(_Box_ParseLine($aSplit[$iLines], "t")) - 1 <= $rX And _Box_ParseLine($aSplit[$iLines], "y") - 1 < $rY Then
- $iButtons += 1
- $element[$iLines - 1][0] = "button"
- $element[$iLines - 1][1] = $pX + _Box_ParseLine($aSplit[$iLines], "x") - 1
- $element[$iLines - 1][2] = $pY + _Box_ParseLine($aSplit[$iLines], "y")
- $element[$iLines - 1][3] = StringLen(_Box_ParseLine($aSplit[$iLines], "t"))
- $element[$iLines - 1][4] = $iButtons
- $element[$iLines - 1][5] = _Box_ParseLine($aSplit[$iLines], "t")
- _Console_Fill($element[$iLines - 1][1], $element[$iLines - 1][2], $element[$iLines - 1][3], 1, "CF", $element[$iLines - 1][5])
- EndIf
- EndIf
- If StringLeft($aSplit[$iLines], 2) = "!!" Then
- If _Box_ParseLine($aSplit[$iLines], "x") + StringLen(_Box_ParseLine($aSplit[$iLines], "t")) - 1 <= $rX And _Box_ParseLine($aSplit[$iLines], "y") - 1 < $rY Then
- $element[$iLines - 1][0] = "text"
- $element[$iLines - 1][1] = $pX + _Box_ParseLine($aSplit[$iLines], "x") - 1
- $element[$iLines - 1][2] = $pY + _Box_ParseLine($aSplit[$iLines], "y")
- $element[$iLines - 1][3] = StringLen(_Box_ParseLine($aSplit[$iLines], "t"))
- $element[$iLines - 1][4] = ""
- $element[$iLines - 1][5] = _Box_ParseLine($aSplit[$iLines], "t")
- _Console_Fill($element[$iLines - 1][1], $element[$iLines - 1][2], $element[$iLines - 1][3], 1, "F0", $element[$iLines - 1][5])
- EndIf
- EndIf
- If StringLeft($aSplit[$iLines], 2) = "$$" Then
- If _Box_ParseLine($aSplit[$iLines], "x") + _Box_ParseLine($aSplit[$iLines], "t") - 1 <= $rX And _Box_ParseLine($aSplit[$iLines], "y") - 1 < $rY Then
- $iInps += 1
- If Not $inpSel Then
- $inpSel = $iLines
- EndIf
- $element[$iLines - 1][0] = "input"
- $element[$iLines - 1][1] = $pX + _Box_ParseLine($aSplit[$iLines], "x") - 1
- $element[$iLines - 1][2] = $pY + _Box_ParseLine($aSplit[$iLines], "y")
- $element[$iLines - 1][3] = _Box_ParseLine($aSplit[$iLines], "t")
- $element[$iLines - 1][4] = $iInps
- $element[$iLines - 1][5] = ""
- _Console_Fill($element[$iLines - 1][1], $element[$iLines - 1][2], $element[$iLines - 1][3], 1, "8F", " ")
- EndIf
- EndIf
- Next
- Local $szLastE
- If $iButtons Then
- _Console_SetCursorVisible(1)
- While 1
- If $inpSel Then _Console_GotoXY($element[$inpSel - 1][1] + StringLen($element[$inpSel - 1][5]), $element[$inpSel - 1][2])
- $iMouse[0] = 0
- _Console_ReadInput($CONSOLE_INPUT, $tRecord, 1)
- Switch DllStructGetData($tRecord, "EventType")
- Case $MOUSE_EVENT
- Local $tMouseRecord = DllStructCreate($tagINPUT_RECORD_MOUSE, DllStructGetPtr($tRecord))
- $iMouse[0] = DllStructGetData($tMouseRecord, "dwButtonState")
- $iMouse[1] = DllStructGetData($tMouseRecord, "X") + 1
- $iMouse[2] = DllStructGetData($tMouseRecord, "Y") + 1
- For $iE = 0 To $aSplit[0] - 1
- While $element[$iE][0] = "button" And $element[$iE][2] = $iMouse[2] And IfX($iMouse[1], $element[$iE][1], $element[$iE][1] + $element[$iE][3] - 1)
- _Console_Fill($element[$iE][1], $element[$iE][2], $element[$iE][3], 1, "47", $element[$iE][5])
- $iMouse[0] = 0
- _Console_ReadInput($CONSOLE_INPUT, $tRecord, 1)
- Switch DllStructGetData($tRecord, "EventType")
- Case $MOUSE_EVENT
- Local $tMouseRecord = DllStructCreate($tagINPUT_RECORD_MOUSE, DllStructGetPtr($tRecord))
- $iMouse[0] = DllStructGetData($tMouseRecord, "dwButtonState")
- $iMouse[1] = DllStructGetData($tMouseRecord, "X") + 1
- $iMouse[2] = DllStructGetData($tMouseRecord, "Y") + 1
- Case Else
- _Console_Fill($element[$iE][1], $element[$iE][2], $element[$iE][3], 1, "CF", $element[$iE][5])
- ExitLoop
- EndSwitch
- If $iMouse[0] Then
- _Console_SetCursorVisible(0)
- _Console_GotoXY($lastXY[0] + 1, $lastXY[1] + 1)
- _VariableSet("ButtonNumber", $element[$iE][4])
- _VariableSet("ButtonText", $element[$iE][5])
- If $iInps Then
- _VariableSet("Inputs", $iInps)
- For $iEs = 0 To $aSplit[0] - 1
- If $element[$iEs][0] = "input" Then _VariableSet("InputData" & $element[$iEs][4], $element[$iEs][5])
- Next
- EndIf
- Return 0
- EndIf
- If $element[$iE][0] = "button" And $element[$iE][2] = $iMouse[2] And IfX($iMouse[1], $element[$iE][1], $element[$iE][1] + $element[$iE][3] - 1) Then
- Else
- _Console_Fill($element[$iE][1], $element[$iE][2], $element[$iE][3], 1, "CF", $element[$iE][5])
- EndIf
- WEnd
- If $element[$iE][0] = "input" And $iMouse[0] And $element[$iE][2] = $iMouse[2] And IfX($iMouse[1], $element[$iE][1], $element[$iE][1] + $element[$iE][3] - 1) Then $inpSel = $iE + 1
- Next
- Case $KEY_EVENT
- $tKeyRecord = DllStructCreate($tagINPUT_RECORD_KEY, DllStructGetPtr($tRecord))
- $bKeyDown = DllStructGetData($tKeyRecord, "bKeyDown")
- $cChar = DllStructGetData($tKeyRecord, "UnicodeChar")
- $iCode = DllStructGetData($tKeyRecord, "wVirtualKeyCode")
- If $bKeyDown And $inpSel Then
- Switch $iCode
- Case 8
- $element[$inpSel - 1][5] = StringTrimRight($element[$inpSel - 1][5], 1)
- Case 32
- If StringLen($element[$inpSel - 1][5]) < $element[$inpSel - 1][3] Then $element[$inpSel - 1][5] &= " "
- Case 9
- For $iE = 0 To $aSplit[0] - 1
- If $element[$iE][0] = "input" And $element[$iE][4] = $iInps And $iE + 1 = $inpSel Then
- For $iE2 = 0 To $aSplit[0] - 1
- If $element[$iE2][0] = "input" Then
- $inpSel = $iE2 + 1
- ExitLoop 2
- EndIf
- Next
- EndIf
- If $element[$iE][0] = "input" And $iE + 1 > $inpSel Then
- $inpSel = $iE + 1
- ExitLoop
- EndIf
- Next
- EndSwitch
- If StringInStr($inpSet, $cChar) And StringLen($element[$inpSel - 1][5]) < $element[$inpSel - 1][3] Then $element[$inpSel - 1][5] &= $cChar
- _Console_Fill($element[$inpSel - 1][1], $element[$inpSel - 1][2], $element[$inpSel - 1][3], 1, "88", " ")
- _Console_Fill($element[$inpSel - 1][1], $element[$inpSel - 1][2], StringLen($element[$inpSel - 1][5]), 1, "8F", $element[$inpSel - 1][5])
- EndIf
- EndSwitch
- WEnd
- EndIf
- EndSwitch
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement