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();
    ?>

  • 相关阅读:
    dubbo和spring的@service注解区别
    mybatisplus乐观锁
    mybatis中llike模糊查询中#和$的使用,以及bind标签的使用
    mybatis的两个内置参数
    mybatis返回主键
    mybatis使用foreach进行批量保存
    jsp自定义标签
    java.lang.ClassNotFoundException:oracle.jdbc.OracleDriver
    junit测试框架
    junit断言和junit注释assert
  • 原文地址:https://www.cnblogs.com/secbook/p/2654905.html
Copyright © 2011-2022 走看看