Author Topic: ML Menu interactions  (Read 1957 times)

garry23

  • Contributor
  • Hero Member
  • *****
  • Posts: 1707
ML Menu interactions
« on: January 11, 2017, 06:16:42 PM »
Just some feedback on ML use.

I have a script running that detects I'm in the ML menu and (on the EOSM) converts the [INFO] button into a dedicated [Q] button, so I can go in and out of the ML menus with ease, ie without touching the screen, eg if I have gloves on.

Here is the relevant redacted part of the script:

Code: [Select]
if menu.visible then
if key == KEY.INFO then -- sim [Q] test
q_pressed = true
return false
else
return true
end
end

All is OK, until you switch on the intervalometer, whilst staying in the ML menu: then the above code doesn't work.

Strange  ???

garry23

  • Contributor
  • Hero Member
  • *****
  • Posts: 1707
Re: ML Menu interactions
« Reply #1 on: January 11, 2017, 06:29:34 PM »
Should have said that the other part of my script looks like this:

Code: [Select]
function simq(arg)
if q_pressed and menu.visible then
key.press(KEY.Q)
q_pressed = false -- reset
return false
else
return true
end
end

event.shoot_task = simq

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 12183
  • Maintenance mode
Re: ML Menu interactions
« Reply #2 on: January 11, 2017, 07:21:23 PM »
You should be able to send the Q event directly from the GUI task (no need for a shoot_task hook).

garry23

  • Contributor
  • Hero Member
  • *****
  • Posts: 1707
Re: ML Menu interactions
« Reply #3 on: January 11, 2017, 07:34:20 PM »
@A1ex

The strangeness is that the script works fine for every other ML menu, i.e. My keypress using [INFO] button to simulate Q works perefectly. As soon as you switch on the intervalometer in the ML menu, it stops working. Only in that case.

Not sure what you mean by from the GUI task, unless you mean the screen touch and don't wish to use that.

On the EOSM because Q and SET are the same button, you don't have a dedicated Q. Which ISO why I wrote the script.

Bottom line: I'm not 'worried' about the behavior, as I know it exists and can work round it.

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 12183
  • Maintenance mode
Re: ML Menu interactions
« Reply #4 on: January 11, 2017, 07:38:00 PM »
I mean something like this:

Code: [Select]
if menu.visible then
if key == KEY.INFO then -- sim [Q] test
key.press(KEY.Q)
return false
else
return true
end
end

The issue is that shoot_task hook doesn't run while the intervalometer is active. Can be changed if it makes sense.

garry23

  • Contributor
  • Hero Member
  • *****
  • Posts: 1707
Re: ML Menu interactions
« Reply #5 on: January 11, 2017, 07:48:48 PM »
Makes sense: thanks  :)

garry23

  • Contributor
  • Hero Member
  • *****
  • Posts: 1707
Re: ML Menu interactions
« Reply #6 on: January 11, 2017, 09:18:32 PM »
@A1ex

Justed tested out your suggestion and it doesn't work. In fact I remembered why I had to go the event.shoot_task route.

The reason, I think, is that I am already 'inside' event.keypress, thus calling key.press(x) wont work.

Or at least it doesn't seem to work, ie cbr error.

Unless you think I'm wrong, I'll go back to just setting the flag inside event.keypress and using that flag in event.shoot_task, and live with the minor intervalometer 'feature' when the ML menu is showing.

Cheers

Garry

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 12183
  • Maintenance mode
Re: ML Menu interactions
« Reply #7 on: January 11, 2017, 09:51:11 PM »
Minimal example:

Code: [Select]
-- Open ML submenus with INFO

function test4Q(k)
if k == KEY.INFO and menu.visible then
key.press(KEY.Q)
return false
else
return true
end
end

event.keypress = test4Q

BTW, please don't forget Audionut's advice.

garry23

  • Contributor
  • Hero Member
  • *****
  • Posts: 1707
Re: ML Menu interactions
« Reply #8 on: January 11, 2017, 10:18:47 PM »
@A1ex/@Audionut

Forgot the 'Lua guidance' : Sorry.

Also worked out what was going wrong, I had tried what you did but it didn't work: why?

Because, stupidly I was doing this:

Code: [Select]
function test4Q(key)
if key == KEY.INFO and menu.visible then
key.press(KEY.Q)
return false
else
return true
end
end

event.keypress = test4Q

That is using "key", ie you used "k". I changed it to something else and all is OK.

Many thanks for the help/education.

Cheers

Garry