GREEN_X5 пишет:kalikazandr пишет:Добрый день. А окно авторизации по типу квиковского как-то можно сделать?
Нет, нельзя. vcl не позволяет нарисовать форму Form, нет элемента Edit и кнопки Button.
Еще раз спасибо за примеры. Вот набросал окно авторизации, корявенькое конечно, ну какое есть:
VCL = require "qvcl"
local is_run = true
local login, pass = "вася", "123"
local msg = ""
function OnStop() myForm:Release(); VCL = nil; is_run = false end
local buttonInput = function ()
local eL,eP = editLogin.Text, editPass.Text
if eL ~= "" and eP ~= "" then
if eL == login and eP == pass then
msg="Приятного заработка"
else msg="Ща торгону" end
myForm:Release(); VCL = nil
end
end
local buttonCancell = function ()
myForm:Release(); VCL = nil; is_run=false
end
local OnKeyDown = function (Sender, key)
if key == 13 then
local SN = Sender.Name
if SN == "Ibutton" then buttonInput()
elseif SN == "Cbutton" then buttonCancell() end
end
end
myForm = VCL.Form( {
Height = 170, Width = 240, Caption = "Идентификация",
Position = "podesktopcenter",
OnClose = function (sender) sender:Release(); VCL = nil; is_run=false end } )
StaticText = VCL.StaticText(myForm, { Name = "StaticText",
top=10, left=20, Width = 200, Height=45,
BorderStyle="sbsSunken", Alignment = "taCenter", Caption="Введите Ваше Имя"})
editLogin = VCL.Edit( myForm, { top=30, left=22, Width=196, Height=20} )
StaticText1 = VCL.StaticText(myForm, {Name = "StaticText1",
top=70, left=20, Width = 200, Height=45,
BorderStyle="sbsSunken", Alignment = "taCenter", Caption="Введите Ваш пароль"})
editPass = VCL.Edit( myForm, { top=90, left=22, Width=196, Height=20} )
Ibutton = VCL.Button(myForm,"Ibutton")
Ibutton._ = { Top=130, Left=20, width=80, height=25, caption="ввод", OnClick = buttonInput, OnKeyDown = OnKeyDown }
Cbutton = VCL.Button(myForm,"Cbutton")
Cbutton._ = { Top=130, Left=140, width=80, height=25, caption="отмена", OnClick = buttonCancell, OnKeyDown = OnKeyDown }
myForm:Show()
function main()
repeat sleep(1)
until VCL == nil
if is_run then message(msg,2) end
while is_run do
sleep(1)
end
end
Не понял, как сделать кнопку "ввод" активной, что бы TABом не листать, но это не важно.