Sign in to follow this  
Followers 0
SmallGoD

Gui with tab

19 posts in this topic

Opt('GUIOnEventMode', 1) 
 
$gui = GUICreate('0', 300, 300) 
GUISetOnEvent(-3, 'GUI_EVENT_CLOSE') 
 
$tab = GUICtrlCreateTab(10, 10, 200, 200) 
GUICtrlCreateTabItem('00') 
GUICtrlCreateTabItem('11') 
 
Local $Input[2] 
$Input[0] = GUICtrlCreateInput(0, 20, 39, 40, 20, 0x2000) 
$Input[1] = GUICtrlCreateUpdown(-1, 0xa0) 
GUICtrlSetLimit(-1, 100, -1) 
 
GUICtrlCreateTabItem('') 
 
GUISetState(@SW_SHOW) 
 
GUICtrlSetState($Input[0], 32) 
GUICtrlSetState($Input[1], 32) 
GUICtrlSetData($Input[0], 1) 
 
While 1 
    Sleep(10) 
WEnd 
 
Func GUI_EVENT_CLOSE() 
    Exit 
EndFunc  ;==>GUI_EVENT_CLOSE

Posted Image

Share this post


Link to post
Share on other sites



SmallGoD,

First, welcome to the AutoIt forums. But if you want answers, you need to ask at least one question!

It also helps if you use includes and constant values in your code - despite what you might think, most of us do not know them all off by heart. :-)

Now, what was it you wanted?

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

SmallGoD,

First, welcome to the AutoIt forums. But if you want answers, you need to ask at least one question!

It also helps if you use includes and constant values in your code - despite what you might think, most of us do not know them all off by heart. :-)

Now, what was it you wanted?

M23

GUICtrlSetState($Input[0], 32)
GUICtrlSetState($Input[1], 32)

These functions are not working correctly in this code. I think this is just a bug in AutoIt.

SmallGoD, use GUICtrlDelete() instead GUICtrlSetState(..., $GUI_HIDE).

Share this post


Link to post
Share on other sites

GUICtrlSetState($Input[0], 32)
GUICtrlSetState($Input[1], 32)

These functions are not working correctly in this code. I think this is just a bug in AutoIt.

SmallGoD, use GUICtrlDelete() instead GUICtrlSetState(..., $GUI_HIDE).

Those GuiCtrlSetState lines work fine for me, ie the input and the up/down counter are hidden. (I'm using production version 3.3.0.0)

GuiCtrlDelete is not a good alternative IMO because you then have to recreate the controls when you want to show them again and remember then restore the contents etc.


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

martin, Yashied,

The code works without problem for me too - that is why I asked what the OP wanted to know!

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Share this post


Link to post
Share on other sites

Yashied,

Well spotted!

If you set the second tab to display first (by adding GUICtrlSetState(-1, $GUI_SHOW) immediately after creating it) the problem goes away (or it does for me).

Although that does not explain why it happens if you do not!

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

When I run the code Tab "00" really clean, but if you move the mouse on top of the Tab "00", UpDown is showing. Exactly as in the OP screenshot.

AutoIt 3.3.0.0, Windows XP SP2

???

Aah, I see. if you cause the gui to be redrawn in any way the up/down shows. Maybe the answer is to subclass the updown and turn of repainting when it's hidden if that makes sense.

Or you could do this

#AutoIt3Wrapper_Add_Constants=n
Opt('GUIOnEventMode', 1)

$gui = GUICreate('0', 300, 300)
GUISetOnEvent(-3, 'GUI_EVENT_CLOSE')

$tab = GUICtrlCreateTab(10, 10, 200, 200)
GUICtrlCreateTabItem('00')
GUICtrlCreateTabItem('11')

Local $Input[2]
$Input[0] = GUICtrlCreateInput(0, 20, 39, 40, 20, 0x2000)
$Input[1] = GUICtrlCreateUpdown(-1, 0xa0)
GUICtrlSetLimit(-1, 100, -1)

GUICtrlCreateTabItem('')

GUISetState(@SW_SHOW)
;GUICtrlSetState($Input[1], 32)
;GUICtrlSetState($Input[0], 32)
sleep(3000)
Global $PosIP0 = ControlGetPos($gui, "", $Input[0])
Global $PosIP1 = ControlGetPos($gui, "", $Input[1])
_HideShow($Input[0], 1, $PosIP0)
_HideShow($Input[1], 1, $PosIP1)
sleep(3000)
 _HideShow($Input[0], 0, $PosIP0)
_HideShow($Input[1], 0, $PosIP1)
;GUICtrlSetData($Input[0], 1)

While 1
    Sleep(10)
WEnd

Func GUI_EVENT_CLOSE()
    Exit
EndFunc  ;==>GUI_EVENT_CLOSE

Func _HideShow($ID, $bHide, ByRef $aOP)
    If $bHide Then
        ControlMove($gui, "", $ID, -1000,-1000)
    Else
        ControlMove($gui, "", $ID, $aOP[0], $aOP[1])
    EndIf
EndFunc  ;==>HideShow

EDIT: changed the code so that it would still work if you tried to hide a control twice in succession.

Edited by martin

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

Well, that was fun and educative - but I wonder if we will ever find out what the OP actually wanted? :-)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#11 ·  Posted

Yashied,

Well spotted!

If you set the second tab to display first (by adding GUICtrlSetState(-1, $GUI_SHOW) immediately after creating it) the problem goes away (or it does for me).

Although that does not explain why it happens if you do not!

M23

I missed that Melba23. Tha's a much better answer than I came up with, I wish I'd seen it before I wasted my time thinking up something much more complicated.


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

#12 ·  Posted

Sorry. Bad speak English, but you captured the essence.

I want to change the contents of a hidden input.

Share this post


Link to post
Share on other sites

#13 ·  Posted

SmallGoD,

You already had the answer! GUICtrlSetData works on hidden controls:

#include <GUIConstantsEx.au3>
#include <EditConstants.au3>

Opt('GUIOnEventMode', 1) 

$gui = GUICreate('0', 300, 300) 
GUISetOnEvent($GUI_EVENT_CLOSE, 'GUI_EVENT_CLOSE') 

$tab = GUICtrlCreateTab(10, 10, 200, 200) 
GUICtrlCreateTabItem('00') 
GUICtrlCreateTabItem('11') 
GUICtrlSetState(-1, $GUI_SHOW)

Local $Input[2] 
$Input[0] = GUICtrlCreateInput(0, 20, 39, 40, 20, $ES_NUMBER) 
$Input[1] = GUICtrlCreateUpdown(-1, 0xa0) 
GUICtrlSetLimit(-1, 100, -1) 

GUICtrlCreateTabItem('') 

GUISetState(@SW_SHOW) 

GUICtrlSetState($Input[0], $GUI_HIDE) 
GUICtrlSetState($Input[1], $GUI_HIDE) 
; Set the contents of the hidden input
GUICtrlSetData($Input[0], "This is the input") 
; Wait a few seconds
Sleep(2000)
; And then read it to show it works
ConsoleWrite(GUICtrlRead($Input[0]) & @CRLF)
; Change it again
GUICtrlSetData($Input[0], "This is another input") 
; Wait a few more seconds
Sleep(2000)
; And then read it again
ConsoleWrite(GUICtrlRead($Input[0]) & @CRLF)

While 1 
    Sleep(10) 
WEnd 

Func GUI_EVENT_CLOSE() 
    Exit 
EndFunc ;==>GUI_EVENT_CLOSE

I hope that answers your question. We had fun along the way!

M23

P.S. Notice the use of include files, which lets you use constant strings like $GUI_EVENT_CLOSE, $GUI_SHOW, $GUI_HIDE and $ES_NUMBER rather than bare numbers. Much easier for us mere humans to understand. ;-)


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

Sorry. Bad speak English, but you captured the essence.

I want to change the contents of a hidden input.

You must have this to say in the first post.

I do not see any problem here. GUICtrlSetData() works great for this.

Edited by Yashied

Share this post


Link to post
Share on other sites

#15 ·  Posted (edited)

This does not solve the problem with the UpDown!

LOL

Edited by SmallGoD

Share this post


Link to post
Share on other sites

#16 ·  Posted

This does not solve the problem with the UpDown!

LOL

What then is the problem? The problem with the updown that has been discussed here was solved by Melb23, so is there some other 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

#17 ·  Posted (edited)

This is not applicable in practice

Example:

#include <GUIConstantsEx.au3>
#include <EditConstants.au3>

Opt('GUIOnEventMode', 1) 

$gui = GUICreate('0', 300, 300) 
GUISetOnEvent($GUI_EVENT_CLOSE, 'GUI_EVENT_CLOSE') 

$tab = GUICtrlCreateTab(10, 10, 200, 200) 
GUICtrlCreateTabItem('00') 
Local $Input0[2] 
$Input0[0] = GUICtrlCreateInput(100, 20, 39, 40, 20, $ES_NUMBER) 
$Input0[1] = GUICtrlCreateUpdown(-1, 0xa0) 
GUICtrlSetLimit(-1, 100, -1) 

GUICtrlCreateTabItem('11') 
GUICtrlSetState(-1, $GUI_SHOW)

Local $Input[2] 
$Input[0] = GUICtrlCreateInput(0, 20, 39, 40, 20, $ES_NUMBER) 
$Input[1] = GUICtrlCreateUpdown(-1, 0xa0) 
GUICtrlSetLimit(-1, 100, -1) 

GUICtrlCreateTabItem('') 

GUISetState(@SW_SHOW) 

GUICtrlSetState($Input[0], $GUI_HIDE) 
GUICtrlSetState($Input[1], $GUI_HIDE) 
GUICtrlSetState($Input0[0], $GUI_HIDE) 
GUICtrlSetState($Input0[1], $GUI_HIDE) 
; Set the contents of the hidden input
GUICtrlSetData($Input[0], "This is the input") 
GUICtrlSetData($Input0[0], "This is the input") 
; Wait a few seconds
Sleep(2000)
; And then read it to show it works
ConsoleWrite(GUICtrlRead($Input[0]) & @CRLF)
; Change it again
GUICtrlSetData($Input[0], "This is another input") 
; Wait a few more seconds
Sleep(2000)
; And then read it again
ConsoleWrite(GUICtrlRead($Input[0]) & @CRLF)

While 1 
    Sleep(10) 
WEnd 

Func GUI_EVENT_CLOSE() 
    Exit 
EndFunc;==>GUI_EVENT_CLOSE
Edited by SmallGoD

Share this post


Link to post
Share on other sites

SmallGoD,

You did not try very hard to make it work, did you? :-)

#include <GUIConstantsEx.au3>
#include <EditConstants.au3>

Opt('GUIOnEventMode', 1) 

$gui = GUICreate('0', 300, 300) 
GUISetOnEvent($GUI_EVENT_CLOSE, 'GUI_EVENT_CLOSE') 

$tab = GUICtrlCreateTab(10, 10, 200, 200) 
$tabitem0 = GUICtrlCreateTabItem('00') 
Local $Input0[2] 
$Input0[0] = GUICtrlCreateInput(100, 20, 39, 40, 20, $ES_NUMBER) 
$Input0[1] = GUICtrlCreateUpdown(-1, 0xa0) 
GUICtrlSetLimit(-1, 100, -1) 

$tabitem1 = GUICtrlCreateTabItem('11') 

Local $Input1[2] 
$Input1[0] = GUICtrlCreateInput(0, 20, 39, 40, 20, $ES_NUMBER) 
$Input1[1] = GUICtrlCreateUpdown(-1, 0xa0) 
GUICtrlSetLimit(-1, 100, -1) 

GUICtrlCreateTabItem('') 

GUISetState(@SW_SHOW) 

GUICtrlSetState($tabitem1, $GUI_SHOW)
GUICtrlSetState($Input1[0], $GUI_HIDE) 
GUICtrlSetState($Input1[1], $GUI_HIDE) 

GUICtrlSetState($tabitem0, $GUI_SHOW)
GUICtrlSetState($Input0[0], $GUI_HIDE) 
GUICtrlSetState($Input0[1], $GUI_HIDE) 

; Set the contents of the hidden input
GUICtrlSetData($Input1[0], "This is the input in 1") 
GUICtrlSetData($Input0[0], "This is the input in 0") 
; Wait a few seconds
Sleep(2000)
; And then read it to show it works
ConsoleWrite("Input 1 reads: " & GUICtrlRead($Input1[0]) & @CRLF)
ConsoleWrite("Input 0 reads: " & GUICtrlRead($Input0[0]) & @CRLF)
; Change it again
GUICtrlSetData($Input1[0], "This is another input in 1") 
GUICtrlSetData($Input0[0], "This is another input in 0") 
; Wait a few more seconds
Sleep(2000)
; And then read it again
ConsoleWrite("Input 1 now reads: " & GUICtrlRead($Input1[0]) & @CRLF)
ConsoleWrite("Input 0 now reads: " & GUICtrlRead($Input0[0]) & @CRLF)

While 1 
    Sleep(10) 
WEnd 

Func GUI_EVENT_CLOSE() 
    Exit 
EndFunc;==>GUI_EVENT_CLOSE

It looks as if you must have the tab showing before trying to send the HIDE commands to the controls on it - slightly weird, but easy to get around.

By the way, why do you want a hidden input with an up-down in the first place? The idea of an input is for a user to enter data - a bit tricky if it is invisible!

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Thank you ... I am clear.

Just the evening and did not immediately understand.

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