Unity Button List - list

Hey everyone I am trying to create a Button List in the parent of the buttons but when I wrote;
public List<Button> buttonList;
I get an error how can I fix that ? I want to loop through my buttons and give them listener but like I said I can't write it this way and when I try to write it with GameObject instead of Button I can't onClick and Listener to it.

Did you try to import UI library from Unity Engine. At the top of your script you should add:
using UnityEngine.UI;

I added using UnityEngine.UI and it worked

Add
using UnityEngine.UI;
replace
public List<Button> buttonList;
to
public List<Button> buttonList = new List<Button>();

Related

How to use OnMouseLeftButtonDown on WPF for C++

I'm doing a demo project on Windows Presentation Foundation with C++, and I'm trying to invoke a callback function when the user clicks the mouse anywhere on the screen.
I just have an empty main page:
public ref class MainPage sealed
{
public:
MainPage();
};
I know that I must override OnMouseLeftButtonDown(). However I can't find a sample code anywhere, especially on Microsoft's page about it. In particular, I can't find how to import MouseButtonEventArgs on C++.
Can you help me? Thanks!
Try this to hook up the event handler:
this->MouseLeftButtonDown += gcnew MouseButtonEventHandler(this, &TheEventHandler);
The MouseButtonEventArgs class is in the System.Windows.Input namespace:
using namespace System.Windows.Input;
So the problem was that my project was configured for UWP, not WPF. Silly me...
Thanks for the tips!

How do I access the index from a clicked UI Button inside a widget in Unreal Engine 4 C++?

I am working on a UI menu using Unreal Engine 4 and C++. I have this code (taken from this thread):
H:
UPROPERTY(meta = (BindWidget)) UButton* TestButton;
UFUNCTION() void OnClick();
CPP:
void UWidgetClassName::NativeConstruct()
{
Super::NativeConstruct();
if (!TestButton->OnClicked.IsBound()) TestButton->OnClicked.AddDynamic(this, &UWidgetClassName::OnClick);
}
void UWidgetClassName::OnClick()
{
//I want to access the index of the clicked button here
}
The code is a bit simplified, I actually create this buttons dynamically inside a loop, so I end up with many buttons, all of which call the same function. Is there a way to "know" which button was pressed, so for example if I press the first button, I get 1, if I press the second, I get 2, etc?
Thanks a lot :)
So what you could do is make your own button class which you create dynamically and on click you return some form of identifier like and index or something?
If you want to keep it generic you can also add them to some sort of container/list and access the specific button via GetAllChildren on the container which returns an array.
Hope that helps!

How to delete the top bar in MFC?

I'm using MFC to create a windows GUI project,As the scrrencap,i want to delete the top menu(or called otherthing,i don't know),anyone can tell me how to make it,thanks very much!
In CMainFrame::OnCreate after the lines:
m_wndRibbonBar.Create(this);
m_wndRibbonBar.LoadFromResource(IDR_RIBBON);
add the following line:
m_wndRibbonBar.GetQuickAccessToolbar()->RemoveAll();
The above approach works in a new Office style MFC app.
Of course another way could be to subclass CMFCRibbonBar and add the call to
GetQuickAccessToolbar()->RemoveAll();
at the end of LoadFromResource function.

How to add aurioTouch files to custom program?

I'm trying to integrate the aurioTouch Apple sample in my app. I have put all the code that was in aurioTouch. When I import FFTBufferManager to my custom class it show error:
How can I fix this?
The solution is given in following steps.
Open your project and import all classes from aurioTouch(inculde aurioTouchAppDelegate class)
This step is somewhat tricky .. open your class xib ..is this drag object from object library and put class of object to aurioTouchAppDelegate class
In your xib, drag view and put its class to eaglview ... know once again click on object in its connection tab .. you will see view and window .. if you see that means you are going in right direction .. make connection of your view with that
Make outlet of OBJECT in your custom class ... ...run your project it will show graph in your custom class.

Multiple UI files for Qt mobile app

I have multpile ui files .
I want to navigate througth them according to pushbutton clicks.
How can I control this in the code ?
how can i do that?
Each ui file generally has cpp class assotiated with it.
Just create it and show.
class myGuiClass: public QWidget{...}; // class assotiated with ui
void SomeOtherClass::onSomePushButtonClicked()
{
myGuiClass* wnd= new myGuiClass(this);
wnd->show();
}