Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » TabCtrl » trouble with tabs ((identifying selected tab))
Re: trouble with tabs [message #52480 is a reply to message #52444] Sun, 06 October 2019 18:06 Go to previous messageGo to previous message
mtdew3q is currently offline  mtdew3q
Messages: 181
Registered: July 2010
Location: Upstate, NY (near Canada)
Experienced Member

Hi Koldo-

I got knocked out of U++ this past couple of days by busy moments at work and elsewhere.

I had some time today to look at my code and got it working.

I wanted a system where the menus changed based on which tab is selected.

Here is the code for that.

Thanks so much for replying last time, and sorry for being confused.

Below is the code that is now working. THNX !

 #include <CtrlLib/CtrlLib.h>
#include "cookie.h"


void Blam::Setup ()
{


	CtrlLayout ( *this, String ( "Blam" ) + " 1.0" );

	tab.Add ( a1.SizePos(), "a1" );
	tab.Add ( a2.SizePos(), "a2" );

	AddFrame ( menu ).LeftPosZ ( 0, 304 ).TopPosZ ( 0, 15 );;

	menu.Set ( THISBACK ( MainMenu1 ) );


	tab.WhenSet = [&]
	{
		PromptOK ( "Selected tab " + FormatInt ( tab.Get() ) );

		if ( tab.IsAt ( a1 ) )
		{
			menu1.Clear();
			PromptOK ( "At a1" );
			menu.Set ( THISBACK ( MainMenu1 ) );

		}

		else
			if ( tab.IsAt ( a2 ) )
			{
				PromptOK ( "At a2" );
				menu.Clear();
				menu.Set ( THISBACK ( MainMenu2 ) );

			}


	};


}



void Blam::MainMenu1 ( Bar& bar )
{

	bar.Sub ( "cookie 1", [=] ( Bar & bar )
	{
		bar.Add ( "eat cookie 1", THISBACK ( func1 ) );

	}

			);

}

void Blam::MainMenu2 ( Bar& bar )
{

	bar.Sub ( "cookie 2", [=] ( Bar & bar )
	{
		bar.Add ( "eat cookie 2", THISBACK ( func2 ) );

	}

			);

}




GUI_APP_MAIN
{
	Blam b;
	b.Setup();
	b.Run();


}
  
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Background color of layout
Next Topic: How do I change TabCtrl tab size
Goto Forum:
  


Current Time: Sat Jul 05 12:20:03 CEST 2025

Total time taken to generate the page: 0.02550 seconds