IUP/Controls/IupNavmap: Difference between revisions

From Vendetta Lua
Jump to navigationJump to search
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..."
 
No edit summary
 
Line 1: Line 1:
__NOTOC__
__NOTOC__
__NOEDITSECTION__
__NOEDITSECTION__
navmap{size, expand, scrollbar}
{{IUP Controls}}
    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 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)
    navmap:loadmap('''mode''','''mappath''', '''page''')
:mode: 1 or 2;  1 = gridless; 2 = grid mode
:'''mode''': 1 or 2;  1 = gridless; 2 = grid mode
:mappath: "/lua/maps/(navmap.universemap.lua | system%02dmap.lua)"
:'''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)
:'''page''': systemid - 1; sets the page for sector ids.  start index (upper left) == 1 + (256 * page)


navmap:setpath(GetFullPath())
    navmap:setpath(GetFullPath())


navmap.currentid = <id>; universe map: values are systemid-1; system map: sectorid range determined by the map page
    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.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
    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




Line 24: Line 25:




function navmap:k_any(c)
    function navmap:k_any(c)
:key presses repeat so long as the key is held down
:key presses repeat so long as the key is held down
:ctrl does not repeat, but the combination does.
:ctrl does not repeat, but the combination does.
Line 38: Line 39:
end
end


function navmap:click_cb(index, flags)
    navmap:click_cb(index, flags)
:only triggers when clicking on a mappoint, on mouseup
:only triggers when clicking on a mappoint, on mouseup
:pressing enter does not set a flag
:pressing enter does not set a flag
:pressing space 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.
:in mode 2, if the long-press timeout is met, the callback finishes, not waiting for the button release.
<source>
 
:flags "SC1            L "
    flags "SC1            L "
: 1: S (shift)
        1: S (shift)
: 2: C (ctrl)
        2: C (ctrl)
: 3: 1 (left mouse click)
        3: 1 (left mouse click)
: 16: L (long-press 1 second(?))
        16: L (long-press 1 second(?))
</source>
 


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


function navmap:getfocus_cb()
    function navmap:getfocus_cb()
:triggers:
:triggers:
: when opening the navmap's dialog  
: when opening the navmap's dialog  
Line 61: Line 61:
end
end


function navmap:mouseover_cb(index, str)
    function navmap:mouseover_cb(index, str)
:triggers when  
:triggers when  
: mousing over a map point.  nothing happens when moving the mouse over anything else
: mousing over a map point.  nothing happens when moving the mouse over anything else
Line 68: Line 68:


end
end
[[Category:IUP Controls]]

Latest revision as of 22:38, 11 May 2023


Controls

Dialog
Fill
Hbox
Vbox
Zbox
Cbox
Radio
Button
Canvas
Frame
Label
List
Multiline
Text
Toggle
Progress Bar
Matrix
Tree
Navmap

   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

   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.
   flags "SC1            L "
       1: S (shift)
       2: C (ctrl)
       3: 1 (left mouse click)
       16: L (long-press 1 second(?))


use string.byte() to test for a specific flag
   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