VoyForums
[ Show ]
Support VoyForums
[ Shrink ]
VoyForums Announcement: Programming and providing support for this service has been a labor of love since 1997. We are one of the few services online who values our users' privacy, and have never sold your information. We have even fought hard to defend your privacy in legal cases; however, we've done it with almost no financial support -- paying out of pocket to continue providing the service. Due to the issues imposed on us by advertisers, we also stopped hosting most ads on the forums many years ago. We hope you appreciate our efforts.

Show your support by donating any amount. (Note: We are still technically a for-profit company, so your contribution is not tax-deductible.) PayPal Acct: Feedback:

Donate to VoyForums (PayPal):

Login ] [ Contact Forum Admin ] [ Main index ] [ Post a new message ] [ Search | Check update time ]
Subject: Widget Base GUI 建立 - 1


Author:
R.D.
[ Next Thread | Previous Thread | Next Message | Previous Message ]
Date Posted: 01:18:06 03/15/02 Fri
In reply to: R.D. 's message, "Trackball Demonstration Program" on 01:03:09 03/15/02 Fri

[步驟一]
在這個展示程式中,我們需要一個base widget,其中包含一個draw widget,另外多加一個label widget作為顯示一些訊息。

在IDLDE之下,開啟一個新的文件,儲存為「.pro」檔(檔名可任意取,在這個範例中我取為「tracktest.pro」)

建立主要程式碼:

2.1 建立base、draw、label widget
-----------------------------------------------------
Pro tracktest

WID_BASE_0 = WIDGET_BASE(TITLE='TRACKTEST', XSIZE=300, YSIZE=300, /COLUMN, UNAME='WID_BASE_0')

WID_DRAW_0 = WIDGET_DRAW(WID_BASE_0, XSIZE=250,YSIZE=250, GRAPHICS_LEVEL=2, RETAIN=2, EVENT_PRO='Yabee' , /BUTTON_EVENTS, UNAME='WID_DRAW_0')

WID_LABEL_0 = WIDGET_LABEL(WID_BASE_0, VALUE='Hello',/DYNAMIC_RESIZE, UNAME='WID_LABEL_0')

WIDGET_CONTROL, WID_BASE_0, /REALIZE

;(還沒完唷)
...

End

-------------------------------------------------------
以上的程式碼將建立:

[base widget]
-其widget ID 為 WID_BASE_0, UNAME為'WID_BASE_0', 尺寸為300x300 pixels
<注意!>widget ID為整數,而UNAME為字串,UNAME可用於trace其widget ID( widget_info function)

[draw widget]
-widget ID為WID_DRAW_0, UNAME: 'WID_DRAW_0', 尺寸為250x250 pixels, 其中我們設定graphics_level=2(為object graphic), retain=2(自動重繪), 並開啟button_events, 並設定其對應的處理函式為「yabee」(這個名稱可以自訂)

[label widget]
-widget ID為WID_LABEL_0, UNAME: 'WID_LABEL_0', VALUE即表示label的TITLE

最後一個命令是將這些widget實際建立出來。

....

[ Next Thread | Previous Thread | Next Message | Previous Message ]

Replies:
Subject Author Date
Widget Base GUI 建立 - 2R.D.01:24:27 03/15/02 Fri


Post a message:
This forum requires an account to post.
[ Create Account ]
[ Login ]
[ Contact Forum Admin ]


Forum timezone: GMT-8
VF Version: 3.00b, ConfDB:
Before posting please read our privacy policy.
VoyForums(tm) is a Free Service from Voyager Info-Systems.
Copyright © 1998-2019 Voyager Info-Systems. All Rights Reserved.