Miniwindow Resetting to Upper Left

Posted by Mvineyard on Mon 14 Apr 2014 05:27 AM — 3 posts, 12,613 views.

#0
Can someone help me understand why my mini window keeps resetting? As you can see, I am tracking the windowinfo.window_left and windowinfo.window_top which do give me back correct coordinates but when 'updatewindow' runs it simply resets to 0,0. Am I missing a save window state somewhere?



function OnPluginInstall ()
 win = GetPluginID () .. "_doit"
 windowinfo = movewindow.install (win, miniwin.pos_top_right)
 updatewindow ()
end -- OnPluginInstall

function OnPluginSaveState ()
  movewindow.save_state (win)
end -- function OnPluginSaveState

function updatewindow ()
  if scur > 0 then
   winheight = 25 + (scur * 15)
  else
   winheight = 50
  end
  WindowCreate (win, tonumber(windowinfo.window_left), tonumber(windowinfo.window_top), 225, winheight, 0, 0, ColourNameToRGB ("#EFDFCF")) 
  WindowGradient (win, 0, 0, 0, 0, ColourNameToRGB ("#2F2F4F"), ColourNameToRGB ("black"), miniwin.gradient_vertical)
  WindowFont (win, "f", "Trebuchet MS", 8, true, false, false, false)
  WindowText (win, "f", "Doit: Command Stack", 5, 5, 0, 0, ColourNameToRGB  "dodgerblue")
  WindowText (win, "f", windowinfo.window_left, 165, 5, 0, 0, ColourNameToRGB  "dodgerblue")
  WindowText (win, "f", windowinfo.window_top, 200, 5, 0, 0, ColourNameToRGB  "dodgerblue")

  NOTE: Program bits, 4 calls to windowtext in this portion

  movewindow.add_drag_handler (win, 0, 0, 0, 15)
  WindowShow (win, true)
end
Amended on Mon 14 Apr 2014 05:30 AM by Mvineyard
Australia Forum Administrator #1
Hard to say without seeing the plugin, but is it set to save states?
#2
I do have this in the plugin initiation 'save_state="y"' if that is what you are referring to.

What happens is if I reinstall the plugin the window temporarily shows at 0,0 for about two seconds and then it will move to the location where it last was (good, but its' very sluggish). However, when the plugin is running and the function 'updatewindow()' is called which creates the window again it moves back to 0,0 and stays there. The windowinfo gives the correct coordinates though.

The rest of the program contains triggers which don't actually change any window components. What you're looking at is a stack so when update window is called I've added or removed something from it.