Thread Tools Display Modes
07/20/14, 01:04 AM   #1
circonian
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 613
Lock focus to a control/window


Is it possible to lock focus to a control/window, like the the destroy confirmation window does, so that no actions can be taken until the user clicks a button/option? If not is there a way to call the default destroy confirmation dialog passing it an item by (bagId, slotId) or (itemLink) or something?

* I'm not trying to replace the default pop-up confirmation box, so it doesn't matter if that is possible.

I thought maybe it might be a certain scene I could put the UI into, but looked & don't think that is the solution now. Then I found: "Destroy" SI_GAMECAMERAACTIONTYPE8 (I don't know if that does what I'm thinking), but couldn't find any functions to pass that too to change the game camera action type to find out. I tried to think of another addon that does something like this to look at, but couldn't think of one. Anyone have any ideas?
  Reply With Quote
10/05/14, 12:35 AM   #2
circonian
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 613
I eventually figured this out, but since no one posted a response I figured I would post a brief example. That way if anyone else is curious this might help get you started.

This example does not lock the focus to "ANY" control/window. It creates a popup dialog box and locks focus to it (like the confirmation box you get when you try to destroy an item), but thats exactly what I was looking for when I posted the question.

First you have to to create the dialog like this.
Note: I just copied one I used in an addon & then altered it some (so there may be type-o's/mistakes, its untested) adding optional fields I know of (commented out).
Lua Code:
  1. ESO_Dialogs["USE_A_UNIQUE_NAME"] = {
  2.     title = {
  3.         text = "<<1>> ERROR",  -- Dialog title text: this field must exist --
  4.         align = TEXT_ALIGN_CENTER,  -- optional field --
  5.         --(optional) title = ?   didn't mess with this one, but it is an optional field
  6.     },
  7.     mainText = {
  8.         text = "Error Type: <<1>>, Error Message: <<2>>, Error Occurred At: <<3>>", -- Text for body/contents of dialog box: Must exist --
  9.         align = TEXT_ALIGN_CENTER, -- optional --
  10.         timer = 3, -- Optional means that the 3rd parameter should be converted to a time before being placed in the mainText string --
  11.     },
  12.     buttons = {
  13.         [1] = {
  14.             text = "Ok", -- Button Text: This one must exist --
  15.             --(optional) callback = function(dialog) return dialog.data[i] end, -- dialog.data[i] is the ith parameter --
  16.             --(optional) clickSound = (sound to play when clicking button)
  17.         },
  18.         [2] = {
  19.             text = "Cancel", -- This one must exist --
  20.             --(optional) callback = function(dialog) return dialog.data[i] end, -- dialog.data[i] is the ith parameter --
  21.             --(optional) clickSound = (sound to play when clicking button)
  22.         },
  23.     },
  24. }
Theres also an option to display an animated loading icon, not sure how it works though or where it goes. showLoadingIcon = ? (displays animated loading icon)


Then call it with:
Lua Code:
  1. ZO_Dialogs_ShowDialog("USE_A_UNIQUE_NAME", 3, {titleParams={sErrorType}, mainTextParams={ErrorType, ErrorMessage, TimeErrorOccurred}})
The first parameter must match the name you gave your dialog (we created above).
Second parameter is just some value passed in that you might want to use in your callback functions.
The third parameter holds the titleParams & mainTextParams.

Last edited by circonian : 10/05/14 at 12:41 AM.
  Reply With Quote

ESOUI » Developer Discussions » General Authoring Discussion » Lock focus to a control/window


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off