|
-
December 3rd, 2003, 02:13 PM
#1
Refresing dialog
In my program I have a dialog box (number 1) containing a CTree control and a button opening a new dialog box (number 2) to add information in the CTree control of the previous dialog.
The Ctree control is initialize in the OnInitDialog and in the Onpaint function ( number 1). When I quit (OnOk function ) dialog box number 2, I call
BroadcastSystemMessage ( BSF_QUERY, BSM_ALLCOMPONENTS, WM_PAINT, 0, 0 );
to refresh other dialog ( number 1 )
My problem is when the CTree control is full and the scroll bar appear. When I add info with second dialog box (number2) and when I return to window number 1 ( with Ctree control), it refresh the CTree dialog box (number 1) the Ctree control blick all the ready I click on the control. I solve this problem by removing initialisation of the tree control in the OnPaint function of window number1. But with this function remove, my new information did'nt appear because the Ctree is not refresh.
It is possible to refresh window number 1 with a other method or technique.
Thanks
-
December 3rd, 2003, 02:56 PM
#2
WOW! It's too complicated.
1. The button belongs to the first dialog and the dialog has somethig like OnButton function where you wrote int nRet = dlg2.DoModal(). If it is correct you can write something for case when nRet == IDOK.
2. I think the second dialog can have a parent. And that will be the first. And that's all. The second dialog can send a special message to the parent.
3. Maybe I did not understand and your question is how to be sure that the tree control shows the new item ? If it is, the control must have something like SetItemState, EnsureVisible,...
Anyway, you don't need to re-initialize the tree control - only add new item and call EnsureVisible.
You add new item from the second dialog?
Good luck
-
December 3rd, 2003, 04:07 PM
#3
Ok possibly my first message is to complicate. I try a new explanation.
I have 2 dialog box a parent and a chlid one. The chlid one is create by a OnButton function in the parent. The parent contain a CTree control. Child dialog is use to add information in the CTree control in the parent dialog.
Problem:
My problem appear when the CTree control is full and the scrollbar appear. A this time, I add new item in CTree control with the child dialog. When I close the child dialog and retrun to parent, the CTree control blink all ready I click on the control. I this situation parent dialog is refresh because in OnOk function of child dialog I call
BroadcastSystemMessage ( BSF_QUERY, BSM_ALLCOMPONENTS, WM_PAINT, 0, 0 );
First solution
My problem is cause by OnPaint function of parent window. In this function I initialize the CTree control. In my first solution I remove the initialisation in the OnPaint function and leave it only in the OnInitDialog. But after that, when close my child dialog my parent dialog is not refresh with information I just add.
In this situation, who I can refresh CTree control in parent dialog?
I expect it is a better explanation.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|