Jump to content

GUICtrlCreateGraphic does not respect GUICoordMode


Recommended Posts

Hi,

When I use GUICtrlCreateGraphic with GUICoordMode option set to "2", the graphic component doesn't take the right position.

Let see this example:

#Include <Constants.au3>
#include <GUIConstants.au3>

$window = GUICreate("Test window", 500,500)
Opt("GUICoordMode",2)

GUISetCoord(20,100)

GUICtrlCreateLabel("Text 1",-1,0)
GUICtrlCreateLabel("Text 2",-1,0)

GUICtrlCreateGraphic(-1,0,200,30) ; expected to be under "Text 2"
GUICtrlSetBkColor(-1,0x0000ff)

GUICtrlCreateGraphic(-1,0,200,20) ; expected to be under blue strip
GUICtrlSetBkColor(-1,0xff0000)

GUICtrlCreateLabel("Text 3",-1,0)


GUISetState()


Do
    $msg = GUIGetMsg()
Until $msg=$GUI_EVENT_CLOSE

The two graphics should be between "Text 2" and "Text 3", shouldn't they?

Cheers.

Link to comment
Share on other sites

Hi,

When I use GUICtrlCreateGraphic with GUICoordMode option set to "2", the graphic component doesn't take the right position.

Let see this example:

#Include <Constants.au3>
#include <GUIConstants.au3>

$window = GUICreate("Test window", 500,500)
Opt("GUICoordMode",2)

GUISetCoord(20,100)

GUICtrlCreateLabel("Text 1",-1,0)
GUICtrlCreateLabel("Text 2",-1,0)

GUICtrlCreateGraphic(-1,0,200,30) ; expected to be under "Text 2"
GUICtrlSetBkColor(-1,0x0000ff)

GUICtrlCreateGraphic(-1,0,200,20) ; expected to be under blue strip
GUICtrlSetBkColor(-1,0xff0000)

GUICtrlCreateLabel("Text 3",-1,0)


GUISetState()


Do
    $msg = GUIGetMsg()
Until $msg=$GUI_EVENT_CLOSEoÝ÷ Ù8^·
 ­ªaË,¥u·zÜzz®¢ÔÞÆݪºZÚ®¢ÔÞÆÝêºl¥v}ý¶Ø^È(^?ªê-yu«mz{b½ëaz¥¥ø¥y«­¢+Ø¥¹±Õ±ÐíU%
½¹ÍѹÑ̹ÔÌÐì()=ÁÐ ÅÕ½ÐíU%
½½É5½ÅÕ½Ðì°È¤((ÀÌØíÝ¥¹½ÜôU%
ÉÑ ÅÕ½ÐíQÍÐÝ¥¹½ÜÅÕ½Ðì°ÔÀÀ°ÔÀÀ¤()U%MÑ
½½É ÈÀ°ÔÀ¤()U%
Ñɱ
ÉÑ1° ÅÕ½ÐíQáÐÄÅÕ½Ðì°´Ä°´Ä¤()U%
Ñɱ
ÉÑÉÁ¡¥ ´Ä°ÜÔ°ÈÀÀ°ÌÀ¤)U%
ÑɱMÑ   ­
½±½È ´Ä°ÁàÀÀÀÁ¤()U%
Ñɱ
ÉÑ1° ÅÕ½ÐíQáÐÈÅÕ½Ðì°´Ä°ÄÀÀ¤()U%
Ñɱ
ÉÑÉÁ¡¥ ´Ä°ÈÀÀ°ÈÀÀ°ÈÀ¤ìáÁÑѼչȱÕÍÑÉ¥À)U%
ÑɱMÑ   ­
½±½È ´Ä°ÁáÀÀÀÀ¤()U%
Ñɱ
ÉÑ1° ÅÕ½ÐíQáÐÌÅÕ½Ðì°´Ä°ÈÀÀ¤()U%MÑMÑÑ ¤()¼(ÀÌØíµÍôU%Ñ5Í ¤)U¹Ñ¥°ÀÌØíµÍôÀÌØíU%}Y9Q}
1=M
Link to comment
Share on other sites

Thank you for you reply.

I tested your script but I think it does not solve my problem: you put "75" for top position of first graphic: that's why it's located under first label. However, this position is due to an absolute positionning (whereas I set GUICoordMode to "2"). The first graphic does not take place relative to first text label. According to help file, with this coordinates mode, top and left are offset (and if -1, no offset). See your script:

- Top of first text label is 50 (thanks to GuiSetCoord)

- You put 75 as an offset for top position of first graphic component: it should be at almost 125 (+ height of first text label).

- If you try with Autoit Active window Info, you can see that top position of first graphic component is 75... So this position is not relative to previous cell.

I tried replacing in your script the first graphic component by a text label and it's position is then effectively relative to first text label.

#include <GUIConstants.au3>

Opt("GUICoordMode",2)

$window = GUICreate("Test window", 500,500)

GUISetCoord(20, 50)

GUICtrlCreateLabel("Text 1", -1, -1)

GUICtrlCreateLabel("graphic should be here", -1, 75, 150)
;GUICtrlCreateGraphic(-1, 75, 200, 30)
GUICtrlSetBkColor(-1,0x0000ff)


GUISetState()

Do
    $msg = GUIGetMsg()
Until $msg=$GUI_EVENT_CLOSE

Does everybody agree my analysis? don't you think there is a bug here?

According to you rasim, what specific part of the documentation should I read?

Thanks for help.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...