Viktor的Fortran手记之五 IFC可视化设计(二)

Viktor posted @ Sep 06, 2008 01:45:25 AM in FORTRAN with tags Viktor fortran IFC Intel DlgSet DlgGet 可视化 对话框 控件 读取 设置 , 2999 阅读

5 连接变量和对话框

对话框必须连接到变量上。变量的类型是

type(dialog)

并且定义在IFLOGM.F90模块中。(CFC是定义在DIALOGM模块中)具体的连接方式如下:

use iflogm
include 'resource.fd' !默认的资源文件头
type(dialog) dlg
logical retlog
retlog = DlgInit(IDD_WINDOW, dlg)

6 使用对话框的一般过程

  1. 建立TYPE(dialog)型变量,并调用DlgInitDlgInitWithResourceHandle函数连接对话框。
  2. DlgSet等手段,赋予控件初始值。
  3. 使用DlgSetSub函数,规定控件响应回调程序。
  4. 显示对话框。模态可用DlgModal,无模态情况下用DlgModeless函数调用,并在消息处理例程中增加DLGISDLGMESSAGE事件。
  5. DlgGet等手段取用控件值。
  6. DlgUninit释放对话框。(必要!)

7 Edit和Static

这些都是最普通的控件,使用时,没有必要附加属性指定,因为得以存取的,无非是字串(对应字串型)。DlgGet与DlgSet是重载函数。如果用逻辑型变量存取,修改的是Enabled属性。IFC Documentation给出了一个内部读写的例子,插在事件处理回调程序中:

!无关定义等略

character(256) text !按Viktor的习惯还是写character(len=256)好
logical retlog

select case (control_name)
    case (IDC_EDIT_CELSIUS)
        retlog = DlgGet(dlg, IDC_EDIT_CELSIUS, text) !将Edit内容装入text中
        read (text, *, iostat = retint) cel !所谓“内部读取”,其实是数据转化过程
        if (retint .eq. 0) then !成功,以免没有读到正确的值
            far = (cel - 0.0) * (212.0 - 32) / 100.0 + 32.0 !为什么不化简?
            write (text, *) far !内部输出。不用判断了。
            retlog = DlgSet(dlg, IDC_EDIT_FAR, trim(adjustl(text))) !左对齐好看
        end if
    !下略
end select case

Avatar_small
IOB Mini Statement 说:
Oct 04, 2022 12:34:46 PM

IOB Mini Statement Number — It offers the facility to check account balance and mini statement anytime with missed call and SMS banking. If you successfully register for IOB's mobile banking service, IOB Mini Statement you may also check account balance, get mini statement, transfer funds and perform other similar. For Indian Overseas Bank Account Statement enquiry, type in message MINI <!--?space-->last 4 digit Account Number and send it to 84240 22122.

Avatar_small
12th Question Paper 说:
Feb 17, 2023 12:37:57 AM

Students who wish to attempt the HSLC exams in March and April 2024 must apply through their respective schools or institutions. Candidates who did not pass the first round of examinations may apply for the second round before the deadline. The Board has made provisions to re-total and distribute response scripts in all courses. 12th Question Paper 2024 The deadline for applications is in January. The HSLC 12th Question Paper 2024 will be released by the Board.


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter