[Encerrado] Hotkeys OTC

7983959
em Tópicos Sem Resposta

7983959

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 18/10/12Posts: 9

Olá

quando vamos adicionar uma nova hotkey no OTC

1° clicamos em add, e abre uma tela que vai identificar a próxima tecla que vamos apertar

esta parte reconhece as teclas do teclado, porém nenhuma do mouse

como eu faria para adicionar esta função, para ele reconhecer as teclas do mouse também ?

mais especificamente o midbutton (bolinha do mouse sendo pressionada )

 

acredito que deve ser nesta parte do hotkey_manager.lua

 

Spoiler

function addHotkey()
  local assignWindow = g_ui.createWidget('HotkeyAssignWindow', rootWidget)
  assignWindow:grabKeyboard()

  local comboLabel = assignWindow:getChildById('comboPreview')
  comboLabel.keyCombo = ''
  assignWindow.onKeyDown = hotkeyCapture
end

function addKeyCombo(keyCombo, keySettings, focus)
  if keyCombo == nil or #keyCombo == 0 then return end
  if not keyCombo then return end
  local hotkeyLabel = currentHotkeys:getChildById(keyCombo)
  if not hotkeyLabel then
    hotkeyLabel = g_ui.createWidget('HotkeyListLabel')
    hotkeyLabel:setId(keyCombo)

    local children = currentHotkeys:getChildren()
    children[#children+1] = hotkeyLabel
    table.sort(children, function(a,b)
      if a:getId():len() < b:getId():len() then
        return true
      elseif a:getId():len() == b:getId():len() then
        return a:getId() < b:getId()
      else
        return false
      end
    end)
    for i=1,#children do
      if children == hotkeyLabel then
        currentHotkeys:insertChild(i, hotkeyLabel)
        break
      end
    end

    if keySettings then
      currentHotkeyLabel = hotkeyLabel
      hotkeyLabel.keyCombo = keyCombo
      hotkeyLabel.autoSend = toboolean(keySettings.autoSend)
      hotkeyLabel.itemId = tonumber(keySettings.itemId)
      hotkeyLabel.useType = tonumber(keySettings.useType)
      if keySettings.value then hotkeyLabel.value = tostring(keySettings.value) end
    else
      hotkeyLabel.keyCombo = keyCombo
      hotkeyLabel.autoSend = false
      hotkeyLabel.itemId = nil
      hotkeyLabel.useType = nil
      hotkeyLabel.value = ''
    end

    updateHotkeyLabel(hotkeyLabel)

    boundCombosCallback[keyCombo] = function() doKeyCombo(keyCombo) end
    g_keyboard.bindKeyPress(keyCombo, boundCombosCallback[keyCombo])
  end

  if focus then
    currentHotkeys:focusChild(hotkeyLabel)
    currentHotkeys:ensureChildVisible(hotkeyLabel)
    updateHotkeyForm(true)
  end
end
 

 

obrigado !

7983959

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 18/10/12Posts: 9

up

Benny

nvr gv p
avatar
Infante
Infante

INFOS

Grupo: InfanteRegistrado: 22/12/12Posts: 1958Gênero: MasculinoChar no Tibia: Marley
A questão neste suporte foi encerrada por falta de respostas. Este tópico está fechado e foi movido para Suporte - Tópicos Sem Resposta.

+ Caso a dúvida não tenha sido resolvida você poderá criar outro tópico solicitando ajuda.
* Lembre-se que é permitido dar UP no tópico a cada 24 horas para assim o destacar e manter movimentado.
?