Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS General Discussion » Method to change the caption text for a page in the page navigator control? Collapse All
Subject Author Date
Cyndi Chatman Mar 7, 2007 - 8:20 AM

Is there a way to dynamically change the text of a page after it is inserted?

For example, when the item is first inserted, the caption text is "Initial Text"

pPII = m_wndPageNavigator.ItemInsert(
    PANE_LOCATION,
    _T("Initial Text"),
    (HICON)::LoadImage( ::AfxGetInstanceHandle(), MAKEINTRESOURCE(IDI_IMAGE), IMAGE_ICON, 24, 24, 0 ),
    (HICON)::LoadImage( ::AfxGetInstanceHandle(), MAKEINTRESOURCE(IDI_IMAGE_SMALL), IMAGE_ICON, 16, 16, 0 )
    );

But, if another page is displayed, I want to change the caption to something like "Changed Text"

How can I do this?

Suhai Gyorgy Mar 7, 2007 - 12:37 PM

I modified PageNavigator sample like this:

...
	CExtPageNavigatorWnd::PAGE_ITEM_INFO * pPII = 
		m_wndPageNavigator.ItemInsert(
			-1,
			_T("Mail"),
			(HICON)::LoadImage( ::AfxGetInstanceHandle(), MAKEINTRESOURCE(IDI_MAIL), IMAGE_ICON, 24, 24, 0 ),
			(HICON)::LoadImage( ::AfxGetInstanceHandle(), MAKEINTRESOURCE(IDI_MAIL_SMALL), IMAGE_ICON, 16, 16, 0 )
			);
	CExtPageNavigatorWnd::PAGE_ITEM_INFO * pPII2 = pPII; // added this line
	...
	pPII = m_wndPageNavigator.ItemInsert(
		-1,
		_T("Calendar"),
		(HICON)::LoadImage( ::AfxGetInstanceHandle(), MAKEINTRESOURCE(IDI_CALENDAR), IMAGE_ICON, 24, 24, 0 ),
		(HICON)::LoadImage( ::AfxGetInstanceHandle(), MAKEINTRESOURCE(IDI_CALENDAR_SMALL), IMAGE_ICON, 16, 16, 0 )
		);
	pPII2->TextSet(_T("Mail2")); // added this line
Text of first page is now Mail2, when you run the sample. If you need pPII in another method, you can get it anywhere calling CExtPageNavigatorWnd::PAGE_ITEM_INFO * pPII = m_wndPageNavigator.ItemGetInfo(PANE_LOCATION);