|
|
|
|
|
|
|
|
||
|
|
|
|
|
|
||
|
|
|
|
|
void CChildView :: OnModelessdlg( ) if ( d== NULL ) d = new mydialog ( this ) ; // where mydialog is a class } d -> SetFocus( ) ; // to activate the dialog which is already created } Here, first we have ascertained whether the pointer
d is NULL. If it is, then we have allocated memory dynamically, passed the address of parent window (i.e.
CChildView class) to the constructor of mydialog class. Then we have created dialog and displayed it. If the pointer
d is not NULL then we have activated the dialog by calling
SetFocus( ) so that the same dialog would get activated. void mydialog::PostNcDestroy( ) ( CChildView * ) p ) -> delptr( ) ; } 7. Add a function delptr( ) to CChildView class and enter following code to it. voif CChildView :: delptr( ) delete d ; } |
||
|
|
|
|
|
Private Sub cadd_Click ( ByVal sender As System.Object, ByVal e As System.EventArgs ) Handles cadd.Click If cb.FindStringExact(cb.Text) = -1 Then cb.Items.Add(cb.Text) End If End Sub Here, we have not only added a context
sensitive menu but also given a provision that on clicking the menu
item 'ADD", the text typed in the combo box should get added in the
dropdown list. If the text is already present in the dropdown list it
would not get added to the list. |
||
|
|
|
|
|
|
||
|
|
|
|
|
|
||
|
|
|
|
|
|
||