Jump to content

Search the Community

Showing results for tags 'focusbrowser'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Multi Theft Auto: San Andreas 1.x
    • Support for MTA:SA 1.x
    • User Guides
    • Open Source Contributors
    • Suggestions
    • Ban appeals
  • General MTA
    • News
    • Media
    • Site/Forum/Discord/Mantis/Wiki related
    • MTA Chat
    • Other languages
  • MTA Community
    • Scripting
    • Maps
    • Resources
    • Other Creations & GTA modding
    • Competitive gameplay
    • Servers
  • Other
    • General
    • Multi Theft Auto 0.5r2
    • Third party GTA mods
  • Archive
    • Archived Items
    • Trash

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Gang


Location


Occupation


Interests

Found 1 result

  1. Boa noite pessoal, Pense na seguinte situação: Voce tem os resources A, B e C, todos eles utlizam browser, cada um com um fim especifico para o sistema. Para manter tudo funcionando perfeitamente, sem um click interferir em 2 browser ao mesmo tempo foi integrado o focusBrowser, mas isso me causou um outro problema que é "Eu preciso saber qual browser está com o focus no momento indepente do resource que esteja com ele e salvar o elemento dele para assim que eu fechar o browser atual retornar o focus pro anterior". Vou postar a classe do browser que criei, e duas prints dos sistemas. se alguem tiver uma solução simples que me atenda para um grande numero de browsers eh nois. browser = {} browser.__index = browser function browser.create(x,y,w,h,localy,url) local self = setmetatable({},browser) self.x = x self.y = y self.w = w self.h = h self.url = url self.tick = getTickCount() self.element = createBrowser(self.w,self.h,localy,true) self.init = function() self:setUrl(url) end self.cursorMove = function(_,_,x,y) if self.element:isFocused() then self:onCursorMove(x,y) end end self.scrol = function(key) if self.element:isFocused() then self:key(key) end end self.onClick = function(button,state) if self.element:isFocused() then self:click(button,state) end end addEventHandler("onClientClick",root,self.onClick) addEventHandler("onClientKey",root,self.scrol) addEventHandler("onClientBrowserCreated",self.element,self.init) addEventHandler("onClientCursorMove",root,self.cursorMove) return self end function browser:render() local posX,posY,alpha = self.x,self.y,1 dxDrawImage(posX,posY,self.w,self.h,self.element,0,0,0,tocolor(255,255,255,255*alpha)) end function browser:setUrl(url) self.element:loadURL(url,"",false) self:requestFocus(true) end function browser:requestFocus(bool) if bool then focusBrowser(self.element) else focusBrowser(nil) end end function browser:execJS(string) executeBrowserJavascript(self.element,string) end function browser:checkPageName(name) if string.find(self.element:getURL():lower(),name,1,true) then return true end return false end function browser:key(key) if key == "mouse_wheel_down" then self.element:injectMouseWheel(-40,0) elseif key == "mouse_wheel_up" then self.element:injectMouseWheel(40,0) end end function browser:onCursorMove(x,y) local posX,posY = self.x,self.y self.element:injectMouseMove(x-posX,y-posY) end function browser:click(button,state) if state == "down" then self.element:injectMouseDown(button) else self.element:injectMouseUp(button) end end function browser:getUrl() return self.element.url end function browser:destroy() removeEventHandler("onClientClick",root,self.onClick) removeEventHandler("onClientKey",root,self.scrol) removeEventHandler("onClientBrowserCreated",self.element,self.init) removeEventHandler("onClientCursorMove",root,self.cursorMove) self.element:destroy() setmetatable(self,nil) end
×
×
  • Create New...