[Học phần mềm] AutoPlay 3 Password / Confirm on Exit

457

3./ Password / Confirm on Exit
< Back – Một số ví dụ
A/. Password: tạo Password khi mở chương trình
Đặt Password bảo vệ. Khi chạy chương trình, sẽ hiện hộp thoại thông báo nhập Password, nếu đúng sẽ mở chương trình, nếu sau chương trình sẽ đóng lại
Tạo Password, sử dụng Dialog.PasswordInput

  • Nhấn phải vào trang (Page1) > Properties > tab Script > On Show, nhập:
— the ‘correct’ password
real_password = “password”;

— prompt the user to enter a password
user_password = Dialog.PasswordInput(“Password”, “Please enter the password: “, MB_ICONQUESTION);

— compare the user’s password to the ‘correct’ password.
— If the user supplies the wrong password, exit the program.
if real_password ~= user_password then
    Application.Exit();
end

B./ Confirm on Exit: xác nhận trước khi đóng chương trình
Khi nhấn nút Close (nút dấu chéo ở góc trên) của chương trình, hoặc các nút tự tạo để đóng chương trình sẽ hiện hộp thông báo xác nhận đóng chương trình
  • Nhấn Project > Global Functions, nhập
function QueryAllowProjectClose()  –this function will be called when the program is exiting
    confirmation = Dialog.Message(“Are you sure?”, “Are you sure that you want to exit?”, MB_YESNO, MB_ICONEXCLAMATION, MB_DEFBUTTON1);
    if confirmation == 6 then
        — The yes button was pressed, allow program to close (return true)
       return true;
   else
       — The yes button was NOT pressed, do NOT allow the program to close (Return false)
        return false;
    end
end
  • Ghi chú: Có thể phải dùng thêm Script đại khái như sau:

if QueryAllowProjectClose() then
   Application.Exit();
end

 

THÔNG TIN GÓP Ý
        Quý thầy cô hoặc bạn đọc muốn đóng góp tài liệu, vui lòng gửi về:
    Fanpage: https://www.facebook.com/linhhoitrithuc (Chia sẻ tài nguyên miễn phí)
    Email: linhhoitrithuc@gmail.com  
Thống kê truy cập
  • Đang truy cập2
  • Hôm nay96
  • Tháng hiện tại14,987
  • Tổng lượt truy cập99,150
GIÁO ÁN THEO CHỦ ĐỀ
ĐỀ THI HK 2 TIỂU HỌC
giáo án theo công văn 5512
facebook
Đăng nhập
Hãy đăng nhập thành viên để trải nghiệm đầy đủ các tiện ích trên site
Bạn đã không sử dụng Site, Bấm vào đây để duy trì trạng thái đăng nhập. Thời gian chờ: 60 giây