TornadoFX modal window shifting position after each opening - kotlin

im having a little positioning problem with TornadoFX (JavaFX) openModal() window. I have a main table with some data, and after doubleclick it opens a little modal window with a table with 3 columns and buttons. Every time I open the window, it will shift to the right and down a little. So after 12-15 opening-closing on FullHD, the bottom of the window will be out of the bounds, meaning I cant see the bottom buttons of the modal window.
OpenModal is using standard x,y position calculation taken from Component.kt:
x = owner.x + (owner.width / 2) - (scene.width / 2)
y = owner.y + (owner.height / 2) - (scene.height / 2)
How is the calculation of coordinates after every opening a little off to the right and down.
I want to open my modal window to open everytime on the center of the screen.
I have made some corections, but I can only apply it when function onDock is caled, and after that the window is centered, but it just jumps back to the center when onDock is caled.
Is openModal bad for consecutive openings, should I use something else to open new window?

Related

When centring a label it goes behind a panel

I'm using the code:
Label1.Left = (Me.ClientSize.Width / 2) - (Label1.Width / 2)
to center the label, but it seems to hide behind panel1 when I center it, it does not disappear behind it when not centering it.
I have right-clicked the panel and sent to back but that doesn't seem to do anything.
Thanks
Use Anchor property for centering the label.
In designer:
Remove all anchors, by default Top and Left anchors are enabled
In code:
Label1.Anchor = AnchorStyles.None
Enabled anchors keep selected distance to the parent boundaries same when parent size is changed.
When opposite anchors are disabled distance to parent's corresponding boundaries will be kept even.

autohotkey not working for CarbonPoker application

I've tested my script on other windows, such as the Calculator (so it's not simply a problem with my script), but when I'm running the CarbonPoker application, the table window won't move. I can activate the window, and I can get the title and display it with MsgBox, but I can't get it to move.
I've tried
WinMove,0,0
and I've tried
WinGetTitle, Title, A
WinMove,ahk_id %Title%,, %xval%,%yval%,%width%,%height%
and I've tried
WinMove,%Title%,, %xval%,%yval%,%width%,%height%
Are there some applications which can't have their windows moved? Or is there a way to still do it for such applications? Thanks.
Code Updated. Now you can move window if it is overlapped by other window. Also added variable for WinTitle.
You can also try to move window other way:
CoordMode, Mouse, Screen ;sets coordinate mode relative to screen.
DestX:=200 ; the x coordinate of the point where you want to see left upper point of window.
DestY:=10 ; the y coordinate of the point where you want to see left upper point of window.
WinTitleVar:="Notepad" ; The part of WinTitle of window that we need to move.
;Here are shift variables. What they meen? You cant just drug by left upper corner of window. You need to shift slightly right and down to be able to drag window. That variables are giving that shift to your coordinates.
ShiftX:= 30 ; shift for x coordinate.
ShiftY:= 10 ; shift for y coordinate.
DestX:= DestX + ShiftX ; apply shift to DestX .
DestY:= DestY + ShiftY ; apply shift to DestY .
SetTitleMatchMode, 2 ; Whith that command a window's title can contain WinTitle anywhere inside it to be a match. It is for WinGetPos command. You can remove this command, but then you need to use exact title in WinGetPos command.
WinGetPos, InitX, InitY,,, %WinTitleVar% ; get current upper left position of notepad window.
InitX:= InitX + ShiftX ; apply shift to InitX .
InitY:= InitY + ShiftY ; apply shift to InitY .
WinActivate, %WinTitleVar% ; Activates Window. This command is here in cases if other window overlaps the window that we need to move.
Click, Left, Down, %InitX%, %InitY% ; Click the left button but dont release it at the shifted coordinates of current window location.
MouseMove, %DestX%, %DestY% ; Move mouse to the shifted destination coordinates.
Click, Left, Up ; Release Left mouse button.
I commented code as much as possible but if you have any questions feel free to ask.
First, if your other application is being run as administrator, then your script also needs to be run with the same administrator permissions. I would check this first.
Next, you can try using the hwnd instead of the title:
; hover mouse over the window, and press f3 to move window
f3::
MouseGetPos,,, hwnd
WinMove, ahk_id %hwnd%,, 0, 0
return

Change location of buttons at execution VB.NET

I am trying to change the location and size of buttons I have contained in a panel on a WinForm (vb.NET).
Initially the buttons have a location and an image (no text), but in execution I want to set a new location and text.
I am able to set the text for each button, and as they are set to Autosize, they increase in width.
But despite I set the location by code correctly, when the buttons are displayed they "come back" to their initial position.
Any help would be appreciated.
Thanks,
IM
The following code will change the location to the co-ordinates you specify:
Button1.Location = New Point(x, y)
You must change the x,y values to the co-ordinates on the form that you want to move the button too.
The next bit of code with change the size of your button:
Button1.Height = 10
Button1.Width = 50

Why do I have to set VerticalScroll.Value twice?

I've got a Windows form that contains a picturebox that holds images of differing size - width is always the width of the form, height is calculated to keep the aspect ratio steady.
The up & down arrows (and home, end keys) are configured to scroll the window - but I'm finding I have to make the following call twice to 'properly' scroll:
Me.VerticalScroll.Value += 100
Me.VerticalScroll.Value += 100
The first call changes the scroll position (but not the scrollbar position), then the second changes the scrollbar position.
Why is this? Am I setting the wrong option here?

how to create a sliding open door effect

i'm looking to create a sliding open door effect with jquery that has the following functionality:
arrive on the page and the doors are closed
click a link and the doors slide outwards a fixed amount on the x-axis
click the same link again and the doors close
i started out with the concept here, which works great:
http://buildinternet.com/2009/07/animate-curtains-opening-with-jquery/
but realised that i wanted the doors to slide across, rather than shrink in size, using the type of functionality seen here:
http://ricostacruz.com/jquery.transit/
so i think what i am looking for is some type of 'animate' functionality:
http://api.jquery.com/animate/
this is the logic of the functionality i am trying to achieve:
static state:
background: an image that is revealed when the doors slide open.
door-left-inner: 122px wide x 244px high, centered and offset left -61px with z-index 3.
door-left-outer: 122px wide x 244px high, centered and offset left -151px with z-index 2.
door-right-inner: 122px wide x 244px high, centered and offset right 61px with z-index 3.
door-right-outer: 122px wide x 244px high, centered and offset right 151px with z-index 2.
onclick (all these functions take place at the same time):
door-left-inner x-position slide on click: -164px on x-axis.
door-left-outer x-position slide on click: -74px on x-axis.
door-right-inner x-position slide on click: 164px on x-axis.
door-right-outer x-position slide on click: 74px on x-axis.
here is a diagram of what i am trying to achieve:
attempted code (not currently working)
$("#open_close_doors").click(function(){ $("#leftdoor_inner").animate({"left": "-=50px"}, "slow");});​
and here is my jsfiddle attempt at getting one of the doors to slide - i figure once i know how to get one of the doors sliding i'll be able to apply the same logic to the others. also i'm a relative newb to jquery.
http://jsfiddle.net/9zsdN/
thank you.
Here's the corrected jsFiddle for the same: http://jsfiddle.net/9zsdN/1/
$("#open_close_doors").click(function(){ $("#leftdoor_inner").animate({"left": "-=50px"}, "slow");});​
It should be:
$(".open_close_doors").click(function(){
$("#leftdoor_inner").animate({"left": "-=50px"}, "slow");
});​
The difference lies in the way you access an element. As you can see, when you access an element by class, you use " .classsname" instead of "#classname" as you have done.
"#name" is used for accessing elements by their id.