Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29241 Discussions

Vertical scroll of dialog boxes - *QickWin Application

luksx
Beginner
936 Views
I use the Microsoft Visual Studio + Intel Fortran...
I have a lot of data for input in the dialog box... The alternative, would be a vertical scrollbar, but i'm not use...
Someone knows how use?!
Please, explain step by step..
(sorry, my english it's not so good)
0 Kudos
3 Replies
John_B__Walter
Beginner
936 Views
Sounds as though you might be looking for a scrollbar for the entire dialog box because you have more items to display in it than you can display at one time in the size you have available to display the dialog.

Is that correct? I'm assuming that you understand that you can increase the size of the dialog, but there is some reason that you want to keep it smaller and provide a means (scroll bar) for the user to get to the various items in it. This seems like it might be possible since you can have a child window that is scrollable, but I haven't had occasion to attempt this.
0 Kudos
Steven_L_Intel1
Employee
936 Views
I think this has come up before in this forum. What I recall is that Windows does not have the ability to scroll an entire dialog box. John has one approach, but you might want to consider something like a tabbed dialog to keep the vertical dimension down.
0 Kudos
John_B__Walter
Beginner
936 Views
Now that you mention it Steve, I did have an application where I did just that. The tabs worked well, and were convenient because the items were grouped according to the names I picked for the tabs, no scrolling to locate the desired item. My tabs actually corresponded to different functions that could be performed with the dialog, but any natural division of the various items into different tabs would work.

In this code fragment, IDD_MAIN is the dialog box which contains the tab item IDC_TAB, and each of the tabs amounts to another dialog box which displays in the location of the tab item when its tab is selected. The set tabs section defines the number of tabs, and specifies labels for those tabs. The remaining DlgInit calls initialize each of the tabs. Notice that each tab has its own DLG_x dialog variable, which is later used to access the items on that tab.
[fortran] IF (.NOT. DlgInit(IDD_MAIN,DLG)) THEN ! and ActiveX dialog RETINT = MESSAGEBOXQQ( 'Unable to initlize IDD_MAIN'C, & trim(PROGNAME)//'... ERROR'C,MB$OK) CALL EXIT END IF call dlgsettitle(dlg, PROGNAME//TRIM(VERSION_DATE) ) ! ! set tabs retlog = dlgset(DLG,IDC_TAB,4) ! 4 tabs retlog = dlgset(DLG,IDC_TAB,"Run",1) retlog = dlgset(DLG,IDC_TAB,"Count",2) retlog = dlgset(DLG,IDC_TAB,"config",3) retlog = dlgset(DLG,IDC_TAB,"changers",4) retlog = dlgset(DLG,IDC_TAB,IDD_Run,1) retlog = dlgset(DLG,IDC_TAB,IDD_Count,2) retlog = dlgset(DLG,IDC_TAB,IDD_CONFIG,3) retlog = dlgset(DLG,IDC_TAB,IDD_changers,4) ! ! setup RUN tab if (.not. DlgInit(IDD_Run,DLG_run)) & RETINT = MESSAGEBOXQQ( 'Problem with IDD_Run'C, & trim(PROGNAME),MB$OK) ! ! setup Count tab if (.not. DlgInit(IDD_Count,DLG_cnt)) & RETINT = MESSAGEBOXQQ( 'Problem with IDD_Count'C, & trim(PROGNAME),MB$OK) ! ! setup CONFIG tab if (.not. DlgInit(IDD_CONFIG,DLG_cnfg)) & RETINT = MESSAGEBOXQQ( 'Problem with IDD_CONFIG'C, & trim(PROGNAME),MB$OK) ! ! setup CHANGERS tab if (.not. DlgInit(IDD_changers,DLG_chg)) & RETINT = MESSAGEBOXQQ( 'Problem with IDD_changers'C, & trim(PROGNAME),MB$OK) [/fortran]It is also necessary to have a dialog init routine:

[fortran]! each tab has a call to DLGMODELESS in init_DLG (another subroutine, specified as EXTERNAL ! in this routine ! Because of the following, init_DLG is called on initialization and destruction of IDD_MAIN retlog = dlgsetsub(dlg,IDD_MAIN,init_DLG,DLG_INIT) RETINT = DLGMODAL(dlg) [/fortran]here is the fragment of init_DLG
[fortran] subroutine init_DLG(DLGx,CONTROL_NAME,CALLBACKTYPE) USE IFWINTY use MyCommon ! where I pass other DLG variables use IFLOGM USE IFCOM use ifqwin implicit none TYPE (DIALOG) DLGx ! this is the one for IDD_MAIN INTEGER CALLBACKTYPE INTEGER CONTROL_NAME integer(HANDLE) hwnd { stuff deleted} if (CALLBACKTYPE == dlg_init) then !dialog just created hwnd = DlgID2Hwnd(dlgX%hwnd, IDC_TAB) retlog = dlgmodeless(DLG_run,SW_hide,hwnd) retlog = dlgmodeless(DLG_cnt,SW_hide,hwnd) retlog = dlgmodeless(DLG_cnfg,SW_hide,hwnd) retlog = dlgmodeless(DLG_chg,SW_hide,hwnd) retlog = DlgSet(dlgX, IDC_TAB, 4, dlg_state) else if (CALLBACKTYPE == DLG_DESTROY) then ! we're done with IDD_Main call dlgexit(DLG_run) CALL DLGUNINIT(DLG_run) call dlgexit(DLG_cnt) CALL DLGUNINIT(DLG_cnt) call dlgexit(DLG_cnfg) CALL DLGUNINIT(DLG_cnfg) call dlgexit(DLG_chg) CALL DLGUNINIT(DLG_chg) end if end subroutine init_DLG [/fortran]Otherwise, this works much like any other dialog box, only more compact than it might have been.
0 Kudos
Reply