I've tried countless times to fix this issue as I didn't want to try to explain what I've built on here, but have had no luck so here goes...
I built a button that you can drag within a track to resize a couple mini-windows horizontally.
I made it so the track doesn't appear until you mouseover it.
The problem is whenever I change the background image, it messes up my slider, like the positions go all screwy. It still works, but everything connected to it is off.
Let me try to explain this with a couple screen shots.
In the first screenshot, I have dragged the slider up, and you can see how the separator line and the windows are perfect right on top of it.
http://i.imgur.com/OxrMcYt.png
In the second screenshot, I have changed the background, and started to drag it. See how the line is now underneath it? Now if I change the background image again, it becomes even more messed up.
http://i.imgur.com/XGXnBZC.png
This completely baffles me as the background image shouldn't mess with that at all.
Here's some code to show how the background image shouldn't mess with my slider.
This is from a settings menu I built, so here's one of the elseif statements when a different background is selected.
elseif result == "4" then
filename = nil
SetVariable("castle_checked", "two")
DeleteVariable("bgColour")
print("Background Selected: Castle 2")
SetBackgroundImage(GetInfo (66) .. "Generic/layout/outer_background_two.png", 0)
Pretty simple right? So why does it mess with my slider?
Now the more complicated code. I basically took what I learned from being able to drag an image inside a window and made a horizontal slider.
http://www.gammon.com.au/forum/?id=13327
Ok, so I was going to post the full code, but it is very long and quite complicated, and doesn't help at all why the background image would mess with it.
So here's just the dragging part of it, and as you see it doesn't use any info that has to deal with the background image.
function drag_resize(flags, hotspot_id)
button_y_current = GetInfo(284)
delta_y = button_y_current-button_y_original+WINDOW_BORDER_Y
-- keep it from going past the track
if delta_y > 55 then
delta_y = 55
elseif delta_y < -30 then
delta_y = -30
end
WindowRectOp (chat_border_button, 2, 0, 0, 0, 0, ColourNameToRGB("black")) -- clear window
DrawThemed3DRect(chat_border_button, 5, 0, 10, 100) -- slider track
DrawThemed3DRect(chat_border_button, 0, delta_y + 31, 15, delta_y + 15 + 31) -- draggable slider button
points_sep = string.format ("%i,%i,%i,%i,%i,%i", 3, delta_y + 5 + 31, 7, delta_y + 9 + 31, 11, delta_y + 5 + 31) -- down arrow
WindowPolygon (chat_border_button, points_sep,
theme.DETAIL, miniwin.pen_solid, 1, -- pen (solid, width 1)
theme.DETAIL, miniwin.brush_solid, --brush (solid)
true, --close
false) --alt fill
WindowMoveHotspot(chat_border_button, "seperator", 0, delta_y + 30, 15, delta_y + 16 + 30)
WINDOW_SEPERATOR_TOP = delta_y + 76
window_seperator_line () -- so seperator line moves to give visual of where windows will be when done dragging
Redraw()
end -- function drag_resize
I can drag the slider up and down a hundred times without a single problem, but the moment I change the background image, everything around the slider goes off.
I wasn't quite sure how to explain this problem, so hopefully I've got the point across what is going on. |