Thread Rating:
  • 396 Vote(s) - 2.8 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Dialog and moving focus
01-04-2012, 10:24 AM,
#1
Dialog and moving focus
Hi, everybody, Happy new year.

I want to move focus to the TextField in the parent while Dialog is displaying with non modal mode.

But before the Dialog object closes, it's impossible to move focus to the TextField.

How can I move focus to it?

Code:
{curl 7.0 applet}
{curl-file-attributes character-encoding = "utf8"}
{def f = {TextField}}
{def dlg = {Dialog
    {CommandButton
     label="Move to focus",
     {on Action do
      {f.request-key-focus}
     }
    }
   }
}
{spaced-vbox
f,
{CommandButton
label="Show dialog",
{on Action do
  {dlg.show title="Focus Test", modal?=false}
}
}
}
01-12-2012, 07:59 PM,
#2
RE: Dialog and moving focus
Could you put your screen layout into a View ? If you could, then calling View.show before {f.request-key-focus} will do what you want .

But if you have to put your screen layout within a AppletView(such as within the browser), I don't know how to do this .
Code:
{def f = {TextField}}
{def v =
    {View
        {spaced-vbox
            f,
            {CommandButton
                label="Show dialog",
                {on Action do
                    {dlg.show center?=false, title="Focus Test", modal?=false }
                }
            }
        },
    {on WindowClose do
      {exit 0}
    }
    }
}
{def dlg = {Dialog
               {CommandButton
                   label="Move to focus",
                   {on Action do
                       {after 0s do
                           {v.show}
                           {f.request-key-focus}
                       }
                   }
               }
           }
}

{v.show}



Possibly Related Threads...
Thread Author Replies Views Last Post
Question 'Find' dialog custom NEOGURi 1 2,631 08-20-2014, 05:47 PM
Last Post: dyoshida
Forum Jump:


Users browsing this thread:
1 Guest(s)

MyBB SQL Error

MyBB has experienced an internal SQL error and cannot continue.

SQL Error:
1017 - Can't find file: 'mybb_threadviews' (errno: 2)
Query:
INSERT INTO mybb_threadviews (tid) VALUES('386')