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

Initial tab dialog stays empty after update of tab controls (IVF)

alb_f
초보자
1,979 조회수

Hi,

I have an IVF application that uses a tab control with several tabs in a main dialog. At program start, data read from a file is filled in the dialog controls per tab.

All works well except that the dialog in the first tab (who's controls were also updated) does not show anything when all controls on al tabs are updated.

I tried to call DLGFLUSH() but that only leads to the contents of the (edit) controls showing up in the dialog, the rest of the dialog stays empty, for example the edit control  names do not show up.  Also UpdateWindow() and ShowWindow() did not give the result wanted. Only when I switch forth and back between tabs by hand everything is refreshed and the dialogs are shown correctly again.

I have two questions:

1) is there a way to switch between tabs from the software (in such a way that the tab dialog switched to is refreshed and fully shown as if switched to by a user),

2) is there a way to refresh a tab dialog as a whole, so as well the controls as the dialog itself?

 

Thanks,

 

 

0 포인트
8 응답
mfinnis
새로운 기여자 III
1,965 조회수

Have you read Creating_Fortran_Win_Apps_0.pdf ? (It doesn't seem to be included in the current Intel fortran documentation - or, at least, isn't easy to find.) It doesn't address your issue directly but does describe how to set up a tab control and its child dialogs.

0 포인트
alb_f
초보자
1,950 조회수

Yes, I've read that one. I also have the dialog examples from the CVF package which contains the SHOWFONT example using tabs. But my question addresses non-basic functionality not contained in there.

0 포인트
alb_f
초보자
1,906 조회수

The answer to the first question is actually quite simple, use 

lRet = DlgSet( dlg, IDC_TABS, i, DLG_STATE )

where i is the tab number and IDC_TABS the dialog Id containing the tabs.

The second (main) question remains unanswered.

0 포인트
andrew_4619
명예로운 기여자 III
1,883 조회수

A am slightly confused on the context as window will repaint a window if an part of its area becomes invalidated. So selecting it etc cause a repaint.

 

You can force the by posting a message to the handle of the tab (or maybe dialog if the tab is active):

bret = PostMessage(hWnd, WM_PAINT, 0_fwparam, 0_flparam)

 

 

0 포인트
alb_f
초보자
1,823 조회수

Hi Andrew,

thanks for your comment.

I reviewed my code and got rid of all that was not really needed in the first place, and now the tab dialog shows its content.

However I face a new related problem:

 

At runtime I set some tab labels using

bRet = DlgSet( dlgMain, IDC_TAB, iTab, DLG_STATE )
bRet = DlgSet( dlgMain, IDC_TAB, csTitle, iTab)

 for tab number iTab.

This seems to work since if I click on the initial tab label (set during init of the tab control) the label switches to the newly set label.

But how can one redraw a tab label so that it shows the set label right away without any user interaction?

If the new label width differs from the initial label width the tabs now get shifted and mangled (I do not want to use fixed width labels).

I tried your solution on the tab control and tabs but no effect.

 

0 포인트
andrew_4619
명예로운 기여자 III
1,808 조회수

Gosh it is such a long time (15 years??) since I have used the iflogm DLG routines.  You can't do everything with those it is a set of stuff from the windows API that Intel implemented.  I think what you are doing is changing the text on the tab after it has become visible and been rendered.  In that case it doesn't re-render it  until there is a paint event.  In the Windows API you also get that problem  so you create the tab not visible and then call ShowWindow(ItemHandle, SW_SHOW ) to display it after the changes are made. It think there are some options in IFLOGM that allow a similar things.

0 포인트
alb_f
초보자
1,791 조회수

Finally got it

I had to use PostMessage instead of SendMessage.

Using

hwnd = GetDlgItem( dlgMain%hwnd, IDC_TAB)
iRet = PostMessage(hwnd, WM_SETREDRAW, 0, 0)

 at the end of the line made the tab control labels show up correct.

I guess the message was put in the queue to soon when using SendMessage?

Thanks for the discussion, it helped!

0 포인트
andrew_4619
명예로운 기여자 III
1,781 조회수

Yes, Sendmessage sends and waits for it to process  so you can end up with things happening in the wrong sequence, it can be quite confusing If you are still initialising the dialog.  Anyway glad you figured it out.

0 포인트
응답