@@ -134,6 +134,8 @@ void CLuaGUIDefs::LoadFunctions(void)
134134 CLuaCFunctions::AddFunction (" guiMemoGetCaretIndex" , GUIMemoGetCaretIndex);
135135 CLuaCFunctions::AddFunction (" guiMemoSetReadOnly" , GUIMemoSetReadOnly);
136136 CLuaCFunctions::AddFunction (" guiMemoIsReadOnly" , GUIMemoIsReadOnly);
137+ CLuaCFunctions::AddFunction (" guiMemoSetVerticalScrollPosition" , GUIMemoSetVerticalScrollPosition);
138+ CLuaCFunctions::AddFunction (" guiMemoGetVerticalScrollPosition" , GUIMemoGetVerticalScrollPosition);
137139
138140 CLuaCFunctions::AddFunction (" guiLabelSetColor" , GUILabelSetColor);
139141 CLuaCFunctions::AddFunction (" guiLabelGetColor" , GUILabelGetColor);
@@ -316,11 +318,14 @@ void CLuaGUIDefs::AddGuiMemoClass(lua_State* luaVM)
316318 lua_classfunction (luaVM, " create" , " guiCreateMemo" );
317319
318320 lua_classfunction (luaVM, " getCaretIndex" , " guiMemoGetCaretIndex" );
321+ lua_classfunction (luaVM, " getVerticalScrollPosition" , " guiMemoGetVerticalScrollPosition" );
319322
320323 lua_classfunction (luaVM, " setCaretIndex" , " guiMemoSetCaretIndex" );
324+ lua_classfunction (luaVM, " setVerticalScrollPosition" , " guiMemoSetVerticalScrollPosition" );
321325 lua_classfunction (luaVM, " setReadOnly" , " guiMemoSetReadOnly" );
322326
323327 lua_classvariable (luaVM, " caretIndex" , " guiMemoSetCaretIndex" , " guiMemoGetCaretIndex" );
328+ lua_classvariable (luaVM, " verticalScrollPosition" , " guiMemoSetVerticalScrollPosition" , " guiMemoGetVerticalScrollPosition" );
324329 lua_classvariable (luaVM, " readOnly" , " guiMemoSetReadOnly" , " guiMemoIsReadOnly" );
325330
326331 lua_registerclass (luaVM, " GuiMemo" , " GuiElement" );
@@ -3132,6 +3137,29 @@ int CLuaGUIDefs::GUIMemoSetCaretIndex(lua_State* luaVM)
31323137 return 1 ;
31333138}
31343139
3140+ int CLuaGUIDefs::GUIMemoSetVerticalScrollPosition (lua_State* luaVM)
3141+ {
3142+ // bool guiMemoSetVerticalScrollPosition ( gui-memo theMemo, float fPosition )
3143+ CClientGUIElement* theMemo;
3144+ float fPosition ;
3145+
3146+ CScriptArgReader argStream (luaVM);
3147+ argStream.ReadUserData <CGUIMemo>(theMemo);
3148+ argStream.ReadNumber (fPosition );
3149+
3150+ if (!argStream.HasErrors ())
3151+ {
3152+ CStaticFunctionDefinitions::GUIMemoSetVerticalScrollPosition (*theMemo, fPosition );
3153+ lua_pushboolean (luaVM, true );
3154+ return 1 ;
3155+ }
3156+ else
3157+ m_pScriptDebugging->LogCustom (luaVM, argStream.GetFullErrorMessage ());
3158+
3159+ lua_pushboolean (luaVM, false );
3160+ return 1 ;
3161+ }
3162+
31353163int CLuaGUIDefs::GUIMemoGetCaretIndex (lua_State* luaVM)
31363164{
31373165 // bool guiMemoGetCaretIndex ( gui-memo theMemo )
@@ -3153,6 +3181,29 @@ int CLuaGUIDefs::GUIMemoGetCaretIndex(lua_State* luaVM)
31533181 return 1 ;
31543182}
31553183
3184+ int CLuaGUIDefs::GUIMemoGetVerticalScrollPosition (lua_State* luaVM)
3185+ {
3186+ // float guiMemoGetVerticalScrollPosition ( gui-memo theMemo )
3187+ CClientGUIElement* theMemo;
3188+
3189+ CScriptArgReader argStream (luaVM);
3190+ argStream.ReadUserData <CGUIMemo>(theMemo);
3191+
3192+ if (!argStream.HasErrors ())
3193+ {
3194+ CGUIMemo* guiMemo = static_cast <CGUIMemo*>(theMemo->GetCGUIElement ());
3195+ float fPos = guiMemo->GetVerticalScrollPosition () / guiMemo->GetMaxVerticalScrollPosition () * 100 .0f ;
3196+ lua_pushnumber (luaVM, fPos );
3197+ return 1 ;
3198+ }
3199+ else
3200+ m_pScriptDebugging->LogCustom (luaVM, argStream.GetFullErrorMessage ());
3201+
3202+ // error: bad arguments
3203+ lua_pushboolean (luaVM, false );
3204+ return 1 ;
3205+ }
3206+
31563207int CLuaGUIDefs::GUIWindowSetMovable (lua_State* luaVM)
31573208{
31583209 // bool guiWindowSetMovable ( element theElement, bool status )
0 commit comments