Dialog

Example of dialog lua script
   function OnNavigateComplete(Object) --called when dialog ready
   end
   function ОnОк(Object)  
   end
   

All functions that are called from the SimpleTV core, must be defined in the dialog script.

window functions

Object = Show(string Name,string UrlHtml,string UrlLua,number cx,number cy,number Flags,ParentObject(opt))

Parameters
Flags 
    HAVE_SIZE=1, (cx,cy are valid)
    NO_CLOSE=2,
    ALLOW_RESIZE=4,
    CONTEX_MENU_ALLOW=8,
    ALLOW_SCROLL=16,
    USE_THEME=32,
    OPT_HIDE_WINDOW=64, (not visible window)
    OPT_SILENT_MODE=128, (disable JS error messages)
    EMBEDDED_IN_MAINFRAME=256, 
    NOT_MODAL=512,
    NOT_TOP_ON_MAINFRAME=1024, (only if not modal)
    NOT_DIALOG_MODE=2048       (allow ctrl+F and some IE options (remove DOCHOSTUIFLAG_DIALOG flag))
ParentObject(opt) - Parent window ( object, 0 or none - main window, -1 - current foreground window)
Return Value
if function failed - the return value is 'false'. If dialog is modal - the return value is 'true'. Otherwise the return value is dialogs object(lightuserdata), you may use this value in other dialogs functions.
 

SetWindowPos(Object,x,y,cx,cy)

– 0xFFFF - mean no number

x,y,cx,cy = GetWindowPos(Object)

ShowWindow(Object,boolean Show)

SetWindowId(Object,string ID)

string id = GetWindowId(Object)

Object = FindWindowById(string ID)

SetForegroundWindow(Object)

SetWindowName(Object,string_utf8 Name)

  1. - from ver 0.4.8 b6

SetWindowIcon(Object,UTF8_string UriIcon,boolean big)

  1. - from ver 0.4.8 b6

Close(Object)

RedrawWindow(Object)

  1. - from ver 0.4.8 b9

HTML functions

AddEventHandler(Object,'EventName','Id','LuaFunctionName')

 Id=='*' mean all elements
 EventName = OnClick|OnKeyDown|OnClose

RemoveEventHandler(Object,'EventName','Id','LuaFunctionName')

SetElementValueString(Object,stringID,string)

SetElementValueString_UTF8(Object,stringID_utf8,string_utf8)

string = GetElementValueString(Object,stringID)

string_utf8 = GetElementValueString_UTF8(Object,stringID_utf8)

AddComboValue(Object,string ID,string Text,number Index,string Value (opt))

Parameters
Index - -1 for last or combo index

AddComboValue_UTF8

string = GetComboValue(Object,string Id,boolean NeedValue (opt))

return value
 if NeedValue==true then return the value of the combo item, otherwise return the text of combo item.

GetComboValue_UTF8

SelectComboIndex

GetCheckBoxValue

SetCheckBoxValue

SetElementText

SetElementText_UTF8

SetElementHtml

SetElementHtml_UTF8

GetElementHtml

GetElementHtml_UTF8

JS functions

ExecScript(Object,Scr_utf8,ScrType_utf8)

Parameters
Object - main object
Scr_utf8 - script text
ScrType_utf8) - script type (usually "javascript")

Calling Lua from JS (from V0.4.8 b8)

 JS
 window.external.CallLua0(); 
 window.external.CallLua1('somedata'); 
 window.external.CallLua2('somedata1','somedata2');
 LUA
  function JSCallBack0(Object)
  end
  ------------------------------------------------------------------
  function JSCallBack1(Object,param_utf8)
  end
  ------------------------------------------------------------------
  function JSCallBack2(Object,param1_utf8,param2_utf8)
  end
  ------------------------------------------------------------------
Зашли как: Anonymous (Anonymous)
mantis/simpletv/api/dialog.txt · Последние изменения: 28/12/2015 18:42 — SergeyVS
 
За исключением случаев, когда указано иное, содержимое этой вики предоставляется на условиях следующей лицензии: CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki