zoukankan      html  css  js  c++  java
  • PHP写窗体程序

    <?php
    if(!class_exists('gtk')){ die("NO GTK");}

    $wnd=new GtkWindow();
    $wnd->set_title("B.B.S.T");
    $wnd->connect_simple("destroy",array("gtk","main_quit"));

    $lblCredit=new GtkLabel("Please Enter:");
    $lblUserName=new GtkLabel("Username:");
    $lblPassword=new GtkLabel("Password:");

    $txtUserName=new GtkEntry();
    $txtPassword=new GtkEntry();

    $btnLogin=new GtkButton("_Login");
    $btnCancel=new GtkButton("_Cancel");

    $tbl=new GtkTable(4,2);
    $tbl->attach($lblCredit,0,2,0,1);
    $tbl->attach($lblUserName,0,1,1,2);
    $tbl->attach($txtUserName,1,2,1,2);
    $tbl->attach($lblPassword,0,1,2,3);
    $tbl->attach($txtPassword,1,2,2,3);
    $tbl->attach($btnCancel,0,1,3,4);
    $tbl->attach($btnLogin,1,2,3,4);

    $btnLogin->connect_simple("clicked","login",$wnd,$txtUserName,$txtPassword);
    $btnCancel->connect_simple("clicked",array($wnd,'destroy'));

    function login($wnd,$txtUserName,$txtPassword){
    $strUserName=$txtUserName->get_text();
    $strPassword=$txtPassword->get_text();

    $un='/^\w+$/';
    if(preg_match($un,$strUserName) && preg_match($un,$strPassword)){
    $wnd->destroy();
    } else {
    $dialog=new GtkMessageDiaLog($wnd,
    Gtk::DIALOG_MODAL,
    Gtk::MESSAGE_ERROR,
    Gtk::BUTTONS_OK,
    "ID or Password Wrong!");
    $dialog->set_markup("Wrong Info:\nID or Password Wrong!");
    $dialog->run();
    $dialog->destroy();
    }
    }

    $wnd->add($tbl);
    $wnd->show_all();
    Gtk::main();
    ?>

  • 相关阅读:
    NSUserDefaults写作和阅读对象定义自己
    JavaScript三在弹出的对话框中
    mybatis02 架构
    mybatis01
    oracle17 视图
    oracle16 例外
    oracle15 pl/sql 分页
    oracle14 复杂数据类型
    oracle13 触发器 变量
    oracle12 pl/sql
  • 原文地址:https://www.cnblogs.com/secbook/p/2654905.html
Copyright © 2011-2022 走看看