IUP/Controls/IupNavmap

From Vendetta Lua
Revision as of 22:50, 10 May 2023 by Draugath (talk | contribs) (Created page with "__NOTOC__ __NOEDITSECTION__ navmap{size, expand, scrollbar} navmap uses 0-based systemids. all systemid inputs/outputs for navmap methods and events will be this way. elsew...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search


navmap{size, expand, scrollbar}

navmap uses 0-based systemids. all systemid inputs/outputs for navmap methods and events will be this way. elsewhere systemids are 1-based

navmap:loadmap(mode, mappath, page)

mode: 1 or 2; 1 = gridless; 2 = grid mode
mappath: "/lua/maps/(navmap.universemap.lua | system%02dmap.lua)"
page: systemid - 1; sets the page for sector ids. start index (upper left) == 1 + (256 * page)

navmap:setpath(GetFullPath())

navmap.currentid = <id>; universe map: values are systemid-1; system map: sectorid range determined by the map page navmap.clickedid = <id>; moves the clicked sector. universe map: values are systemid-1; system map; range determined by the map page

navmap.["color"..number] does not work in mode 1; number is the sectorid. available sector ids are determined by the current page; changing the page resets all colors; changing back to a previous page does not show previous colors


if no mappoint is selected,

tab will navigate in tab order to other controls


function navmap:k_any(c)

key presses repeat so long as the key is held down
ctrl does not repeat, but the combination does.
no character code for combinations. in a ctrl combo, ctrl only triggers once and the other key triggers repeatedly
arrows trigger mouseover_cb, not k_any.
enter triggers click_cb
space triggers click_cb

keys

ctrl triggers, but does not repeat
shift does not trigger
alt triggers; can't combine with a mouse click on linux

end

function navmap:click_cb(index, flags)

only triggers when clicking on a mappoint, on mouseup
pressing enter does not set a flag
pressing space does not set a flag
in mode 2, if the long-press timeout is met, the callback finishes, not waiting for the button release.

<source>

flags "SC1 L "
1: S (shift)
2: C (ctrl)
3: 1 (left mouse click)
16: L (long-press 1 second(?))

</source>

use string.byte() to test for a specific flag

end

function navmap:getfocus_cb()

triggers:
when opening the navmap's dialog
when pressing escape if the last action was a click
After this callback has triggered, all keyboard presses will trigger :k_any()

end

function navmap:mouseover_cb(index, str)

triggers when
mousing over a map point. nothing happens when moving the mouse over anything else
pressing arrow keys after a mappoint has been selected; order of system traversal on the universe map is in systemid order
pressing tab when a mappoint has been clicked on; triggers the mouseover for the active mappoint

end