Sign in to follow this  
Followers 0
Slym

Vertical Offset in 3.3.0.0

12 posts in this topic

Hi,

I was using the v3.2.12.1 version of AutoIT for a while and today i tried the 3.3.0.0.

I now have a bug (or not ?) with vertical offset in my GUI : All controls are drawn 18px too high on my GUI.

I'm using a lot of GDI+ Functions and i use the well known GetVertOffset() from a user script.

My question is, should I still use the GetVertOffset and fix it or just adjust the vertical offset manually ?

Obviously, the aim is to have no graphic bug on any system (that's why i used GetVertOffset in the first place).

Thank you in advance.

PS: I use the last SciTE4AutoIt3 (1.77) with last definition files (3.2.12.1) on XP SP3


--------------------- [font="Franklin Gothic Medium"]LinuxLive USB Creator[/font], [size="3"]The only Linux Live USB creator with easy integrated virtualization (made with AutoIT)[/size] ---------------------

Share this post


Link to post
Share on other sites



Hi,

I was using the v3.2.12.1 version of AutoIT for a while and today i tried the 3.3.0.0.

I now have a bug (or not ?) with vertical offset in my GUI : All controls are drawn 18px too high on my GUI.

I'm using a lot of GDI+ Functions and i use the well known GetVertOffset() from a user script.

My question is, should I still use the GetVertOffset and fix it or just adjust the vertical offset manually ?

Obviously, the aim is to have no graphic bug on any system (that's why i used GetVertOffset in the first place).

Thank you in advance.

PS: I use the last SciTE4AutoIt3 (1.77) with last definition files (3.2.12.1) on XP SP3

If by "the well known GetVertOffset" you mean my function from here, then I assume that the latest version of AutoIt now takes the menus into account and the fuction is no longet needed.

You could add this line at the start of the function

if @AutoItVersion >= "3.3.0.0" then return 0;

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

Do you have any small reproducing script?

No i don't have any but this is a portion of code I use :

$PNG_GUI = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\img\GUI.png")

$GUI = GUICreate("uSbuntu Live Creator", 400, 700, -1, -1, $WS_POPUP, $WS_EX_LAYERED)

SetBitmap($GUI, $PNG_GUI, 255)
GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST")
GUISetState(@SW_SHOW, $GUI)


$LAYERED_GUI_CORRECTION = GetVertOffset($GUI)
$CONTROL_GUI = GUICreate("CONTROL_GUI", 400, 700, 0, $LAYERED_GUI_CORRECTION, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $GUI)

$TRANS_PIC = GUICtrlCreatePic(@ScriptDir & "\img\TRANS.GIF", 0, 0, 400, 700)

GUICtrlSetState($TRANS_PIC, $GUI_DISABLE)
GUISetState(@SW_SHOW, $CONTROL_GUI)

$ZEROGraphic = _GDIPlus_GraphicsCreateFromHWND($CONTROL_GUI)

....

If by "the well known GetVertOffset" you mean my function from here, then I assume that the latest version of AutoIt now takes the menus into account and the fuction is no longet needed.

If i put 0 it's not working ... under v3.3.0.0 it's returning -5 and under 3.2.12.0 i think it's returning 18 (the right offset).

--------------------- [font="Franklin Gothic Medium"]LinuxLive USB Creator[/font], [size="3"]The only Linux Live USB creator with easy integrated virtualization (made with AutoIT)[/size] ---------------------

Share this post


Link to post
Share on other sites

No i don't have any but this is a portion of code I use :

$PNG_GUI = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\img\GUI.png")

$GUI = GUICreate("uSbuntu Live Creator", 400, 700, -1, -1, $WS_POPUP, $WS_EX_LAYERED)

SetBitmap($GUI, $PNG_GUI, 255)
GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST")
GUISetState(@SW_SHOW, $GUI)


$LAYERED_GUI_CORRECTION = GetVertOffset($GUI)
$CONTROL_GUI = GUICreate("CONTROL_GUI", 400, 700, 0, $LAYERED_GUI_CORRECTION, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $GUI)

$TRANS_PIC = GUICtrlCreatePic(@ScriptDir & "\img\TRANS.GIF", 0, 0, 400, 700)

GUICtrlSetState($TRANS_PIC, $GUI_DISABLE)
GUISetState(@SW_SHOW, $CONTROL_GUI)

$ZEROGraphic = _GDIPlus_GraphicsCreateFromHWND($CONTROL_GUI)

....

If i put 0 it's not working ... under v3.3.0.0 it's returning -5 and under 3.2.12.0 i think it's returning 18 (the right offset).

Ok I guessed about what you meant. I tried the function with 3.3.0.0 and I get the same as I did with earlier versions. XP Pro SP3 now, previously on XP Home SP1.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

Ok I guessed about what you meant. I tried the function with 3.3.0.0 and I get the same as I did with earlier versions. XP Pro SP3 now, previously on XP Home SP1.

I'm not sure to understand. Do you have the issue too or does your function return exactly the same thing on both ?


--------------------- [font="Franklin Gothic Medium"]LinuxLive USB Creator[/font], [size="3"]The only Linux Live USB creator with easy integrated virtualization (made with AutoIT)[/size] ---------------------

Share this post


Link to post
Share on other sites

I'm not sure to understand. Do you have the issue too or does your function return exactly the same thing on both ?

I get exactly the same with the latest version oif AutoIt as I did when I first wrote the function. So I don't have a problem. Maybe it's to do with the OS which is why I told you what I was using.

If I run this script

$Gui = GUICreate("nothing")
ConsoleWrite("Result of offset with no menu = " & GetVertOffset($Gui) & @CRLF)
ConsoleWrite("NOW WITH MENU ADDED" & @CRLF)
ConsoleWrite("===================" & @CRLF)
$menu = GUICtrlCreateMenu("blah")
ConsoleWrite("Result of offset with menu = " & GetVertOffset($Gui) & @CRLF)

Func GetVertOffset($hgui)
    Const $SM_CYCAPTION = 4
    Const $SM_CXFIXEDFRAME = 7
    Local $wtitle, $wclient, $wsize,$wside,$ans
    $wclient = WinGetClientSize($hgui)
    ConsoleWrite("Client height = " & $wclient[1] & @CRLF)
    $wsize = WinGetPos($hgui)
    ConsoleWrite("window height = " & $wsize[3] & @CRLF)
    $wtitle = DllCall('user32.dll', 'int', 'GetSystemMetrics', 'int', $SM_CYCAPTION)
    ConsoleWrite("Caption Height = " & $wtitle[0] & @CRLF)
    $wside = DllCall('user32.dll', 'int', 'GetSystemMetrics', 'int', $SM_CXFIXEDFRAME)
    ConsoleWrite("Frame width = " & $wside[0] & @CRLF)
    $ans = $wsize[3] - $wclient[1] - $wtitle[0] - 2 * $wside[0]
    Return $ans
EndFunc ;==>GetVertOffset

I get this output

Client height = 400
window height = 432
Caption Height = 26
Frame width = 3
Result of offset with no menu = 0
NOW WITH MENU ADDED
===================
Client height = 380
window height = 432
Caption Height = 26
Frame width = 3
Result of offset with menu = 20

The Client height changes by 20 for me so the menu is using up 20 pixels. For you it used to be 18 I suppose.

What do you get if you run that script now?


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

This is what i get :

Client height = 400
window height = 430
Caption Height = 24
Frame width = 3
Result of offset with no menu = 0
NOW WITH MENU ADDED
===================
Client height = 380
window height = 430
Caption Height = 24
Frame width = 3
Result of offset with menu = 20

Actually, i started my software from the lod3n PNG GUI but i'm not using the _GuiCtrlMakeTrans() function so I'm not even sure I have to use your function.

If i put the offset directly in code, do you think my software will render the same on every system (even if the system have a specific theme) ?

Sorry if i sound confused but i'm a bit lost here.

Edited by Slym

--------------------- [font="Franklin Gothic Medium"]LinuxLive USB Creator[/font], [size="3"]The only Linux Live USB creator with easy integrated virtualization (made with AutoIT)[/size] ---------------------

Share this post


Link to post
Share on other sites

This is what i get :

Client height = 400
window height = 430
Caption Height = 24
Frame width = 3
Result of offset with no menu = 0
NOW WITH MENU ADDED
===================
Client height = 380
window height = 430
Caption Height = 24
Frame width = 3
Result of offset with menu = 20
Then I conclude that the offset function isn't causing your problem. I think you need to post some code that shows us the problem.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

This is the source : uSbuntu Sources

I tried to put directly the offset without using GetVertOffset and its seems to well render on both XP SP3 (vista theme and Classis) and XP SP2 (Classic and XP theme).

So maybe i will just not use GetVertOffset.

Edited by Slym

--------------------- [font="Franklin Gothic Medium"]LinuxLive USB Creator[/font], [size="3"]The only Linux Live USB creator with easy integrated virtualization (made with AutoIT)[/size] ---------------------

Share this post


Link to post
Share on other sites

So maybe i will just not use GetVertOffset.

Souinds like the most sensible solution to me :)

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0