Sign in to follow this  
Followers 0
nitekram

GUI - setting size of objects

9 posts in this topic

#1 ·  Posted (edited)

I have this code

#include <GUIConstants.au3>

Global $Extension, $DateGot

Opt("GUICoordMode", 2)
Opt("GUIResizeMode", 1)
Opt("GUIOnEventMode", 1)

$parent1 = GUICreate("Parent1", 500, 500)
GUISetOnEvent($GUI_EVENT_CLOSE, "SpecialEvents")
GUISetOnEvent($GUI_EVENT_MINIMIZE, "SpecialEvents")
GUISetOnEvent($GUI_EVENT_RESTORE, "SpecialEvents")

;#cs
$Extension = GUICtrlCreateCombo("Ext", 0, 0, 0, 25)
GUICtrlSetData($Extension, "507|509|511", "Ext") ; add other item snd set a new default
GUICtrlSetOnEvent($Extension, "EXT")
;#ce

$DateGot = GUICtrlCreateDate("DATE", 200, -25, 0, 25)
GUICtrlSetOnEvent($DateGot, "DatePicked")
#cs
    $ShowLogDate = GUICtrlCreateLabel("DATE",0,50,50,25)
    $ShowLogExt = GUICtrlCreateLabel("EXT",-100,0,50,25)
#ce

GUISetState(@SW_SHOW)


; Just idle around
While 1
    Sleep(10)
WEnd


; END


Func EXT()
    MsgBox(0, "OK Pressed", "ID=" & @GUI_CtrlId & " WinHandle=" & @GUI_WinHandle & " CtrlHandle=" & @GUI_CtrlHandle & @CRLF & "EXT " & GUICtrlRead($Extension))
    ;GUICtrlSetData($ShowLogExt, "Date Picked = " & GUICtrlRead($Extension))
EndFunc   ;==>EXT


Func DatePicked()
    MsgBox(0, "Cancel Pressed", "ID=" & @GUI_CtrlId & " WinHandle=" & @GUI_WinHandle & " CtrlHandle=" & @GUI_CtrlHandle & @CRLF & "Date " & GUICtrlRead($DateGot))
    ;GUICtrlSetData($ShowLogDate, "Date Picked = " & GUICtrlRead($DateGot))
EndFunc   ;==>DatePicked


Func SpecialEvents()
    
    
    Select
        Case @GUI_CtrlId = $GUI_EVENT_CLOSE
            ;MsgBox(0, "Close Pressed", "ID=" & @GUI_CTRLID & " WinHandle=" & @GUI_WINHANDLE)
            Exit
            
        Case @GUI_CtrlId = $GUI_EVENT_MINIMIZE
            MsgBox(0, "Window Minimized", "ID=" & @GUI_CtrlId & " WinHandle=" & @GUI_WinHandle)
            
        Case @GUI_CtrlId = $GUI_EVENT_RESTORE
            MsgBox(0, "Window Restored", "ID=" & @GUI_CtrlId & " WinHandle=" & @GUI_WinHandle)
            
    EndSelect
    
EndFunc   ;==>SpecialEvents

Why would I have to use a -20 -25 to get the top right. Is it my computer or me?

EDIT fixed the -25

Edited by nitekram

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Share this post


Link to post
Share on other sites



Oh crap - I forgot to ask another question on the same code -

$Extension = GUICtrlCreateCombo("Ext", 0, 0, 0, 25)

GUICtrlSetData($Extension, "507|509|511", "Ext") ; add other item and set a new default

Why do I have to use the second line to create the drop down?

Why can't I just add all my text to the first one?


All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Share this post


Link to post
Share on other sites

I've never used GUICoordMode, just commented that out, and just set the position, i.e.

#include <GUIConstants.au3>

Global $Extension, $DateGot

;~ Opt("GUICoordMode", 2)
Opt("GUIResizeMode", 1)
Opt("GUIOnEventMode", 1)

$parent1 = GUICreate("Parent1", 500, 500)
GUISetOnEvent($GUI_EVENT_CLOSE, "SpecialEvents")
GUISetOnEvent($GUI_EVENT_MINIMIZE, "SpecialEvents")
GUISetOnEvent($GUI_EVENT_RESTORE, "SpecialEvents")

;#cs
$Extension = GUICtrlCreateCombo("Ext", 0, 0, 0, 25)
GUICtrlSetData($Extension, "507|509|511", "Ext") ; add other item snd set a new default
GUICtrlSetOnEvent($Extension, "EXT")
;#ce

$DateGot = GUICtrlCreateDate("DATE", 200, 0, 0, 25)
;~ $DateGot = GUICtrlCreateDate("DATE", 200, -25, 0, 25)
GUICtrlSetOnEvent($DateGot, "DatePicked")
#cs
    $ShowLogDate = GUICtrlCreateLabel("DATE",0,50,50,25)
    $ShowLogExt = GUICtrlCreateLabel("EXT",-100,0,50,25)
#ce

GUISetState(@SW_SHOW)


; Just idle around
While 1
    Sleep(10)
WEnd


; END


Func EXT()
    MsgBox(0, "OK Pressed", "ID=" & @GUI_CtrlId & " WinHandle=" & @GUI_WinHandle & " CtrlHandle=" & @GUI_CtrlHandle & @CRLF & "EXT " & GUICtrlRead($Extension))
    ;GUICtrlSetData($ShowLogExt, "Date Picked = " & GUICtrlRead($Extension))
EndFunc   ;==>EXT


Func DatePicked()
    MsgBox(0, "Cancel Pressed", "ID=" & @GUI_CtrlId & " WinHandle=" & @GUI_WinHandle & " CtrlHandle=" & @GUI_CtrlHandle & @CRLF & "Date " & GUICtrlRead($DateGot))
    ;GUICtrlSetData($ShowLogDate, "Date Picked = " & GUICtrlRead($DateGot))
EndFunc   ;==>DatePicked


Func SpecialEvents()
    
    
    Select
        Case @GUI_CtrlId = $GUI_EVENT_CLOSE
            ;MsgBox(0, "Close Pressed", "ID=" & @GUI_CTRLID & " WinHandle=" & @GUI_WINHANDLE)
            Exit
            
        Case @GUI_CtrlId = $GUI_EVENT_MINIMIZE
            MsgBox(0, "Window Minimized", "ID=" & @GUI_CtrlId & " WinHandle=" & @GUI_WinHandle)
            
        Case @GUI_CtrlId = $GUI_EVENT_RESTORE
            MsgBox(0, "Window Restored", "ID=" & @GUI_CtrlId & " WinHandle=" & @GUI_WinHandle)
            
    EndSelect
    
EndFunc   ;==>SpecialEvents

don't have an answer for your second question.


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

That is funny - you beat me to the punch - I was just going to say that I did that. I copied the code right from the help section for GUICtrlCreateCombo and then knew something had to be wrong so started looking at the example again - I guess I should have read everything before trying it out. But still I think the example could do without that (GUICoordMode) opt. Is there somewhere that shows an example of AutoItSetOption - as there is really no examples of those being used, unless you go to the right function, but I still would like to see them used with good examples of the different flags being used. If there is such a place can someone show me?

I know what your thinking - do it. Well, I have no clue how.


All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Share this post


Link to post
Share on other sites

Oh yea, and thanks again for your time @gafrost


All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Share this post


Link to post
Share on other sites

#include <GUIConstants.au3>

Global $Extension, $DateGot

Opt("GUICoordMode", 2)
Opt("GUIResizeMode", 1)
Opt("GUIOnEventMode", 1)

$parent1 = GUICreate("Parent1", 500, 500)
GUISetOnEvent($GUI_EVENT_CLOSE, "SpecialEvents")
GUISetOnEvent($GUI_EVENT_MINIMIZE, "SpecialEvents")
GUISetOnEvent($GUI_EVENT_RESTORE, "SpecialEvents")

;#cs
$Extension = GUICtrlCreateCombo("Ext", 10, 5, 200, 25)
GUICtrlSetData($Extension, "507|509|511", "Ext") ; add other item snd set a new default
GUICtrlSetOnEvent($Extension, "EXT")
;#ce

;~ $DateGot = GUICtrlCreateDate("DATE", 200, 0, 0, 25)
$DateGot = GUICtrlCreateDate("DATE", 0, -1)
GUICtrlSetOnEvent($DateGot, "DatePicked")
#cs
    $ShowLogDate = GUICtrlCreateLabel("DATE",0,50,50,25)
    $ShowLogExt = GUICtrlCreateLabel("EXT",-100,0,50,25)
#ce

GUISetState(@SW_SHOW)


; Just idle around
While 1
    Sleep(10)
WEnd


; END


Func EXT()
    MsgBox(0, "OK Pressed", "ID=" & @GUI_CtrlId & " WinHandle=" & @GUI_WinHandle & " CtrlHandle=" & @GUI_CtrlHandle & @CRLF & "EXT " & GUICtrlRead($Extension))
    ;GUICtrlSetData($ShowLogExt, "Date Picked = " & GUICtrlRead($Extension))
EndFunc   ;==>EXT


Func DatePicked()
    MsgBox(0, "Cancel Pressed", "ID=" & @GUI_CtrlId & " WinHandle=" & @GUI_WinHandle & " CtrlHandle=" & @GUI_CtrlHandle & @CRLF & "Date " & GUICtrlRead($DateGot))
    ;GUICtrlSetData($ShowLogDate, "Date Picked = " & GUICtrlRead($DateGot))
EndFunc   ;==>DatePicked


Func SpecialEvents()
    
    
    Select
        Case @GUI_CtrlId = $GUI_EVENT_CLOSE
            ;MsgBox(0, "Close Pressed", "ID=" & @GUI_CTRLID & " WinHandle=" & @GUI_WINHANDLE)
            Exit
            
        Case @GUI_CtrlId = $GUI_EVENT_MINIMIZE
            MsgBox(0, "Window Minimized", "ID=" & @GUI_CtrlId & " WinHandle=" & @GUI_WinHandle)
            
        Case @GUI_CtrlId = $GUI_EVENT_RESTORE
            MsgBox(0, "Window Restored", "ID=" & @GUI_CtrlId & " WinHandle=" & @GUI_WinHandle)
            
    EndSelect
    
EndFunc   ;==>SpecialEvents


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

I see the differece in the code, but I went to the help and tried this

;#cs

$ShowLogDate = GUICtrlCreateLabel("DATE",-1,0)

$ShowLogExt = GUICtrlCreateLabel("EXT",-2,0)

;#ce

this part is commented out in my code - so how would you adjust these. I do not think I will use the option unless someone can show me how to use it.


All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Share this post


Link to post
Share on other sites

I see the differece in the code, but I went to the help and tried this

;#cs

$ShowLogDate = GUICtrlCreateLabel("DATE",-1,0)

$ShowLogExt = GUICtrlCreateLabel("EXT",-2,0)

;#ce

this part is commented out in my code - so how would you adjust these. I do not think I will use the option unless someone can show me how to use it.

i'm trying to understand, not sure why but see if this makes sense, it may not be the correct terms

$ShowLogDate = GUICtrlCreateLabel("DATE",-400,0,100,25,$SS_SUNKEN) ; -400 the width of both controls previously created, puts it at 10, 0 for the next line
$ShowLogExt = GUICtrlCreateLabel("EXT",0,-1,-1,-1,$SS_SUNKEN) ; 0 offset from previous control, -1 for next cell

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

Well, that makes it clearer - like mud. I tried to add another set up lables and had no luck. I think I will stick to the other way where at least I can make it look right or make sense.

Again, thanks for your help.


All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

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