code_uitextfield.cpp 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. // UITextField application source code
  2. #include "PeriodicApp.h"
  3. void PeriodicApp::setup_uitextfield( UIWidget *layout )
  4. {
  5. PODVector<UIWidget*> dest;
  6. layout->SearchWidgetClass( "TBButton", dest );
  7. for (unsigned ii = 0; ii < dest.Size(); ii++)
  8. SubscribeToEvent(dest[ii], E_WIDGETEVENT, ATOMIC_HANDLER(PeriodicApp, HandleUitextfieldEvent ));
  9. }
  10. void PeriodicApp::HandleUitextfieldEvent(StringHash eventType, VariantMap& eventData)
  11. {
  12. using namespace WidgetEvent;
  13. UIWidget* widget = static_cast<UIWidget*>(eventData[P_TARGET].GetPtr());
  14. if ( widget == NULL ) return;
  15. if (eventData[P_TYPE] == UI_EVENT_TYPE_CLICK)
  16. {
  17. if (widget->GetId() == "uitextfieldcode" )
  18. {
  19. AppLog( " support : " + widget->GetId() + " was pressed " );
  20. ViewCode ( "Components/code_uitextfield.cpp", widget->GetParent() );
  21. }
  22. if (widget->GetId() == "uitextfieldlayout" )
  23. {
  24. AppLog( " support : " + widget->GetId() + " was pressed ");
  25. ViewCode ( "Scenes/layout_uitextfield.ui.txt", widget->GetParent() );
  26. }
  27. }
  28. }