第一印象
範例程式
截圖
與其它函式庫比較
相關應用
下載
教學文件
作品展示(Bazaar)
現狀及發展藍圖
常見問題(FAQ)
作者與授權
論壇
資助Ultimate++
搜尋本網站
語言
中文(繁體)











SourceForge.net Logo



Button

 

Counting button clicks

 

 

Button.cpp

 

#include <CtrlLib/CtrlLib.h>

 

// http://java.sun.com/docs/books/tutorial/uiswing/start/swingTour.html

 

using namespace Upp;

 

struct ButtonApp : TopWindow {

    int    count;

    Button button;

    Label  label;

 

    void RefreshLabel()

    {

        label = Format("Number of button clicks %d", count);

    }

    void Click()

    {

        ++count;

        RefreshLabel();

    }

 

    typedef ButtonApp CLASSNAME;

 

    ButtonApp()

    {

        count = 0;

        button <<= THISBACK(Click);

        button.SetLabel("&I'm an Ultimate++ button!");

        Add(button.VCenterPos(20).HCenterPos(200));

        Add(label.BottomPos(0, 20).HCenterPos(200));

        label.SetAlign(ALIGN_CENTER);

        Sizeable().Zoomable();

        RefreshLabel();

    }

};

 

GUI_APP_MAIN

{

    ButtonApp().Run();

}

 

 

 

 

本頁也正在english, català, čeština, deutsch, español, euskara, français, română, русский中文(简体)中. 你想幫忙嗎?