- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
Hi there,
I want to display a dialog box in an QuickWin application. This dialog box contains values for a calculation, that runs in the background. These values can be updated at run time by the user and he sees in other QuickWin windows how these values affects the calculation in certain diagrams/plots/whatever.
Because I cant use multi-threading (not allowed by the customer) and DlgModal doesnt allow backgrounding calculation, I use a DlgModeless Dialog.
And here is my problem: When I open the DialogBox from the program (!call MainDialog() in the code), I only see the frame, no buttons, no text and the application freezes.But, when I insert in the menu the Dialog Subroutine, it is displayed propably, when I select Dialog from the menu.
Does anybody know why this happens? Do I have to initialize s.th. else before calling the main dialog?
Thanks in advance,
OnkelHotte
Code:
program test use dflogm use dflib implicit none include 'resource.fd' character*72 string logical l external MainDialog type(dialog) dlg type(qwinfo) winfo type(windowconfig) wc winfo%type = QWin$Max l = SetExitQQ (QWin$ExitNoPersist) l = SetWSizeQQ(QWin$Framewindow, winfo) l = InsertMenuQQ(2, 6, $MenuEnabled , '&Dialog'C, MainDialog) l = SetWindowconfig(wc) wc%Title = 'Outputwindow'C wc%NumXPixels = 640 wc%NumYPixels = 446 l = SetWindowconfig(wc) ! call MainDialog() read*,string !stops until input; normally calculation starts here end program test c ********************************************************************* subroutine MainDialog use dflogm implicit none include 'resource.fd' integer iret logical l type(dialog) dlg l = DlgInit(IDD_DIALOG_MAIN,dlg) iret = DlgModeless(dlg) end subroutine MainDialog
링크가 복사됨
6 응답
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
I found something out, but I dont know what to do about it:
With Spy++ I watched the two dialogs. When I open the dialog through call MainDialog(), Window Proc is unavailable, when I open the dialog through the inserted menu, Window Proc is 77D6E54F. IsWindow Proc the reason why my dialog wont open?
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
according to the documentation "routine
(Input) ...EXERNAL. Callback subroutine that is called if the menu item is selected. All routines must take a single LOGICAL parameter which indicates whether the menu item is checked or not. ..."
(Input) ...EXERNAL. Callback subroutine that is called if the menu item is selected. All routines must take a single LOGICAL parameter which indicates whether the menu item is checked or not. ..."
Your callback should have a single argument.
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
Change dlgmodeless to DLGMODAL and it works ok.
However,a modeless dialog box requires a message loop, according to the documentation.That's your problem. Change the code to this and it works:
Code:
subroutine MainDialog(CHECKED) use dflogm use dfwin implicit none include 'resource.fd' integer*4 iret, ret logical CHECKED, lret type(dialog) dlg type (T_MSG) mesg lret = DlgInit(IDD_DIALOG_MAIN,dlg) if(lret.eqv. .false.) then checked=lret return endif iret = DlgModeless(dlg) ! Read and process messages until GetMessage returns 0 because ! PostQuitMessage has been called do while( GetMessage (mesg, NULL, 0, 0) ) ! Note that DlgIsDlgMessage must be called in order to give ! the dialog box first chance at the message. if ( DlgIsDlgMessage(mesg) .EQV. .FALSE. ) then lret = TranslateMessage( mesg ) ret = DispatchMessage( mesg ) end if end do CALL DLGUNINIT(dlg) CHECKED=.TRUE. end subroutine MainDialog
..on second thoughts...having tried the above, and successfully displaying the dialog, I havediscovered that on exiting the application using the system menu close button or the File..Exit menu, on occasion the process is not terminated correctly and remains in memory (visible in the task manager window) even though the Quickwin window vanishes. I would stick with using a modal dialog...
Message Edited by anthonyrichards on 04-27-2005 06:40 AM
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
On your Update: I tried File...Exit a few times and the program exited correctly without staying in memory.
Thanks a lot for your help!
Message Edited by OnkelHotte on 04-27-2005 06:58 AM
