Results 1 to 4 of 4

Thread: Disabling all input for modal dialog

  1. #1
    Lesser Wizard
    Join Date
    Nov 2010
    Location
    Los Angeles, California, United States, United States
    Posts
    126

    Default Disabling all input for modal dialog

    I know you have a few handy functions for part of this, but what if I wanted to *temporarily* disable all buttons and text input and present a dialog box or user prompt (think tutorials, storytelling, pause menus, etc). On clicking an entity in the dialog, I'd like to remove the dialog and re-enable all Entities/Components on the screen. Ideas? I would like to grey-out all entities when they are disabled.

  2. #2
    Administrator Seth's Avatar
    Join Date
    Jul 2002
    Location
    Japan
    Posts
    5,340

    Default

    Well, I think DisableAllButtonsEntity(Entity *pEnt, bool bRecursive) (from EntityUtils.cpp) would do the job.. except if you look in the function, it only handles "Button2D" components. I should have it also check for the name "InputTextRender" because the same "disabled" parm is recognized by that too.

    EnableAllButtonsEntity() is the reverse.
    Seth A. Robinson
    Robinson Technologies

  3. #3
    Lesser Wizard
    Join Date
    Nov 2010
    Location
    Los Angeles, California, United States, United States
    Posts
    126

    Default

    That's where I was headed. I run into issues where some buttons (i.e. radio buttons) are on/off which currently use the enabled/disabled variant. You function turns all on/off together.

    Guess I need to create some more custom components!

  4. #4
    Lesser Wizard
    Join Date
    Nov 2010
    Location
    Los Angeles, California, United States, United States
    Posts
    126

    Default

    Well, this works for now, though alpha doesn't seem to be affected with InputTextRenderComponent.

    Code:
    //
    //  Disables all input entities
    //
    void SetInputDisabled( Entity* pEnt, bool bDisabled, bool bRecursive )
    {
        if(bDisabled)
        {
            pEnt->GetVar("alpha")->Set(0.5f);
        }
        else
        {
            pEnt->GetVar("alpha")->Set(1.0f);    
        }
    
        // go through all components
        ComponentList* pComponents = pEnt->GetComponents();
        ComponentList::iterator componentItor = pComponents->begin();
        while (componentItor != pComponents->end())
        {
            EntityComponent* pComp = ((EntityComponent*)*componentItor);
            
            if( pComp->GetName() == "Button2D")
            {            
                pComp->GetVar("disabled")->Set(uint32(bDisabled));
            }
            else if( pComp->GetName() == "InputTextRender")
            {
                pComp->GetVar("disabled")->Set(uint32(bDisabled));            
            }
            
            componentItor++;
        }
        
        if (!bRecursive) return;
        
        //also run this on all children
        EntityList *pChildren = pEnt->GetChildren();
        
        EntityList::iterator itor = pChildren->begin();
        while (itor != pChildren->end())
        {        
            SetInputDisabled(*itor, bDisabled);
            itor++;
        }
    }

Similar Threads

  1. ScrollComponent - disabling buttons during scroll
    By BigBMan in forum Proton SDK
    Replies: 3
    Last Post: 04-17-2011, 11:36 PM
  2. Dialog Positioning
    By Pleng in forum Novashell Game Creation System
    Replies: 7
    Last Post: 05-13-2009, 02:55 PM
  3. About dialog
    By Eng C. Born in forum Official ClanLib SDK Forums
    Replies: 6
    Last Post: 04-21-2009, 02:41 AM
  4. Dialog System?
    By rgrwkmn in forum Novashell Game Creation System
    Replies: 5
    Last Post: 12-22-2008, 12:29 AM
  5. bug? hitting enter on property edit dialog...
    By whisperstorm in forum Novashell Game Creation System
    Replies: 1
    Last Post: 12-19-2006, 11:32 PM

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •