Sign in to follow this  
Followers 0
lookfar

GUICtrlCreateTabitem

6 posts in this topic

#1 ·  Posted (edited)

this has got me totally frustrated, normally a control is owned by it's parent so the control's left,right,top,height are relative to the parent and not the form. In this case the Tabsheet :

#include <GuiConstants.au3>
If Not IsDeclared('WS_CLIPSIBLINGS') Then Global $WS_CLIPSIBLINGS = 0x04000000
GuiCreate("Form1", 420, 331, 302,218 ,$WS_OVERLAPPEDWINDOW + $WS_CLIPSIBLINGS)
Opt("GUICoordMode",0)
$PageControl1 = GUICtrlCreateTab(88, 32, 257, 201)
$TabSheet1 = GUICtrlCreateTabitem ("TabSheet1")
$Button1 = GuiCtrlCreateButton("Button1", 76, 40, 75, 25)
$Button2 = GuiCtrlCreateButton("Button2", 76, 80, 75, 25)
$TabSheet2 = GUICtrlCreateTabitem ("TabSheet2")
$CheckBox1 = GuiCtrlCreateCheckbox("CheckBox1", 76, 48, 97, 17 )
$CheckBox2 = GuiCtrlCreateCheckbox("CheckBox2", 76, 80, 97, 17 )
GUICtrlCreateTabitem ("")


GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
   ;;;
    EndSelect
WEnd
Exit

The controls position are relative to the tabsheet and not the main form but I simply cannot make it obey the rules...

I have run into the same problem with groupbox and child controls..

does anyone know how I can make this work?

Edited by lookfar

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Of course you know this is where the trouble starts

Opt("GUICoordMode",0)

I wrote an extensive program including many tabs. this was in Autoit 3.1. there were minimal "tab controls". there are more now including <GuiTab.au3>

but this is what i wrote....

$tab = GUICtrlCreateTab(9, 8, 492, 345, BitOR($TCS_MULTILINE, $TCS_RIGHTJUSTIFY))
    
    $tab1 = GUICtrlCreateTabItem("    My Favorites    ")
    GUICtrlCreatePic($Favorites_jpg, 10, 31, 491, 321, $SS_SUNKEN)
    GUICtrlSetState(-1, $GUI_DEFBUTTON); will display this tab first
    GUICtrlCreateLabel("PLEASE Create a Restore Point...", 165, 60, 260, 25)
    $tab11OK = GUICtrlCreateButton("Create Restore", 30, 55, 120, 25, $BS_ICON)

All based on the GUI not the tabs.... and this is what it looked like

http://xpcleanmenu.hostrocket.com/image/Favorites-screen.jpg

Sorry I dont have the answer you were looking for....

8)

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites

Of course you know this is where the trouble starts

Opt("GUICoordMode",0)

I wrote an extensive program including many tabs. this was in Autoit 3.1. there were minimal "tab controls". there are more now including <GuiTab.au3>

but this is what i wrote....

$tab = GUICtrlCreateTab(9, 8, 492, 345, BitOR($TCS_MULTILINE, $TCS_RIGHTJUSTIFY))
    
    $tab1 = GUICtrlCreateTabItem("  My Favorites    ")
    GUICtrlCreatePic($Favorites_jpg, 10, 31, 491, 321, $SS_SUNKEN)
    GUICtrlSetState(-1, $GUI_DEFBUTTON); will display this tab first
    GUICtrlCreateLabel("PLEASE Create a Restore Point...", 165, 60, 260, 25)
    $tab11OK = GUICtrlCreateButton("Create Restore", 30, 55, 120, 25, $BS_ICON)

All based on the GUI not the tabs....  and this is what it looked like

http://xpcleanmenu.hostrocket.com/image/Favorites-screen.jpg

Sorry I dont have the answer you were looking for....

8)

<{POST_SNAPBACK}>

If you have a look at the FormDesigner I'm working on:

drop a groupbox on the form and then drop some checkboxes or radiobuttons on the groupbox and then move the groupbox around the form..

The contols move with the groupbox because they are owned by the groupbox and not the form. this is a standard in GUI development.

AutoIt GUI does not seem to have any Parent/Child relationships for controls so when you "Generate code" the controls are all over the place on the form.

It's too bad..what is needed is a parameter for controls like:

$CheckBox1 = GuiCtrlCreateCheckbox("CheckBox1", 76, 48, 97, 17,$GroupBox1 )

so it will get it's coordinates relative to the groupbox xy and not the form xy

Share this post


Link to post
Share on other sites

you'll have to have logic in your code to discern whether controls are placed in a groupbox, and set the order of creation:

GroupBox

Opt("GUICoordMode",0)

1st Control

2nd Control

Nth Control

Opt("GUICoordMode",1)

Otherwise try GuiStartGroup()


[u]Do more with pre-existing apps![/u]ANYGUIv2.8

Share this post


Link to post
Share on other sites

you'll have to have logic in your code to discern whether controls are placed in a groupbox, and set the order of creation:

GroupBox

Opt("GUICoordMode",0)

1st Control

2nd Control

Nth Control

Opt("GUICoordMode",1)

Otherwise try GuiStartGroup()

<{POST_SNAPBACK}>

I wish it were that simple..

GuiStartGroup() seems to be reserved for control logic not coordinates.

Opt("GUICoordMode",0) just does not work in this case..I have tried every combination

with no joy.

Oh well, I'm going to leave it for now, I want to get onto real time code generation for the form designer ,and have events for onclick, onmouseover etc.

Share this post


Link to post
Share on other sites

I take it you're trying to generate an au3 script from the gui in your formbuilder?

The only other option that even comes to mind would be to use absolute coordinates for every control.


[u]Do more with pre-existing apps![/u]ANYGUIv2.8

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