Jump to content

Problems when losing focus on inputbox


odaylton
 Share

Go to solution Solved by Melba23,

Recommended Posts

Text translated from Portuguese by google - please apologize for any errors

 

First I have to thank the development team for product quality and the ease with which it is possible to develop tools with AutoIt.

 

I am developing a series of libraries to facilitate the creation of Forms that once it is stable and comprehensive I intend to share here for autoit

But suddenly during development an unexpected effect appeared in simple inputbox fields.

 

Everything is working fine, however if I'm in an inputbox, don't change its selected content and move focus to another field the selected text remains blue (selected) instead of returning to normal

See the image....

image.png.16d8a015e63fae771d1e4efb592f23d8.png

When pricing 3x TABs all remain blue

 image.png.56a44c668681de6fce1a949ce2c8daa8.png

However if I change the field , when leaving its focus it behaves normally

See the ex below:

image.png.7e49ac454d01b71a2b14f3fdc1a11170.png

1) I selected “tipo Default” and pressed TAB (to test what happens)

2) typed "TESTE" and pressed TAB

3) I pressed TAB 2x again and the "Centralizado" field turned blue

Note: by default, when receiving focus, the text is always automatically selected

 

Here are some parts of the code:

Gui  create:

;modifique o tamanho inicial aqui
    ;$Form[$Form[0][0]][1] = 600 ;largura =800
    ;$Form[$Form[0][0]][2] = 600 ;Atura =600
    ;$Form[$Form[0][0]][3] = "RoboAutomato - "&$NomeProjeto
    $Form[$Form[0][0]][0] = GUICreate($Form[$Form[0][0]][3], _
            $Form[$Form[0][0]][1], $Form[$Form[0][0]][2], _
            Default, Default, _
            BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_SIZEBOX, $WS_THICKFRAME, $WS_TABSTOP, $WS_POPUP))
    GUISetFont($FormFonteTam, _ ;Tamanho da Fonte
            $FormFonteTipo, _ ;Tipo da Fonte
            $FormFonteEstilo, _ ;Estilo da Fonte
            $FormFonteNome) ; Nome da Fonte
    #Region Criando ToolTip
    $hGUIToolTip = _GUIToolTip_Create($Form[$Form[0][0]][0], BitOR($_TT_ghTTDefaultStyle, $TTS_BALLOON)) ; balloon style tooltip
    #EndRegion Criando ToolTip

 inputs create:

....
InputCriar(200, 200, _ ;Coordenadas Base
            Default, Default, _ ;Largura e Altura  automatica se negativo em função do extremo da janela
            "|Referencia|", _ ;Label do Input
            "Tudo Default ou qq diferente de 1,2,3,4: mais simples", _ ;Texto explicativo do InputBox e seu label
            "Teste do tipo Default", _ ;Valor Default da Input
            Default, _ ;0 é Defaultou define o estilo
            Default, _ ;Defini a forma de incerção Default=20 caracteres "CCCCCCCCCCCCCCCCCCCC"
            Default, _
            Default, _
            Default, _ ; Tipo de alinhamento em relação a Janela
            Default, _ ;Tamanho da Fonte
            Default, _ ;Tipo da Fonte
            Default, _ ;Estilo da Fonte
            Default) ; Nome da Fonte

    InputCriar(200, Default, _ ;Coordenadas Base
            Default, Default, _ ;Largura e Altura  automatica se negativo em função do extremo da janela
            "|Canto inferior esquerdo|", _ ;Label do Input
            "Tipo 1: 2 linhas", _ ;Texto explicativo do InputBox e seu label
            "Tipo 1: 2 linhas", _ ;Valor Default da Input
            1, _ ;0 é Defaultou define o estilo
            Default, _ ;Defini a forma de incerção Default=20 caracteres "CCCCCCCCCCCCCCCCCCCC"
            Default, _
            Default, _
            Default, _ ; Tipo de alinhamento em relação a Janela
            Default, _ ;Tamanho da Fonte
            Default, _ ;Tipo da Fonte
            Default, _ ;Estilo da Fonte
            Default) ; Nome da Fonte
            
            .....

Function InputCriar:

Func InputCriar($InputX = Default, $InputY = Default, _ ;Coordenadas Base Canto Superior Esquerdo se não definido proxima linha e coluna
        $InputWidth = Default, $InputHeight = Default, _ ;Largura e Altura  automatica se negativo em função do extremo da janela
        $InputRotulo = "", _ ;Label do Inpu
        $InputTip = "", _ ;Texto explicativo do InputBox e seu label
        $InputDefault = "", _ ;Valor Default da Input
        $InputAlin = Default, _ ;0 é Defaultou define o estilo
        $InputMascara = Default, _ ;Defini a forma de incerção Default=20 caracteres "CCCCCCCCCCCCCCCCCCCC"
        $InputEstilo = Default, _
        $InputEstiloEx = Default, _
        $InputResizing = Default, _ ; Tipo de alinhamento em relação a Janela
        $InputTamFonte = Default, _ ;Tamanho da Fonte
        $InputFonteTipo = Default, _ ;Tipo da Fonte
        $InputFonteEstilo = Default, _ ;Estilo da Fonte
        $InputFonteNome = Default) ; Nome da Fonte
        
        ....
        $InputEstilo = BitOR($ES_AUTOHSCROLL, _
                        $WS_TABSTOP)
        ...
        $InputEstiloEx = $WS_EX_CLIENTEDGE ;formato baixo relevo
        ...
        $Inputs[$Inputs[0][0]][0] = GUICtrlCreateInput($Mascara5, _ ;Default da Input
            $Form[$Form[0][0]][6]+$InputX, $Form[$Form[0][0]][7]+$InputY, _ ;Coordenadas Base
            $InputWidth, $InputHeight, _ ;Altura e largura automatica
            $InputEstilo, _ ;Estilo
            $InputEstiloEx) ;Extilo extra
        ...
        GUICtrlSetData($Inputs[$Inputs[0][0]][0], $Inputs[$Inputs[0][0]][3])
        Return $Inputs[$Inputs[0][0]][0]
EndFunc   ;==>InputCriar

sorry for not putting all the code because there are many libraries and they are in the initial stage of development

 

What should I change to get Inputbox's behavior back to normal????

Thank you for your attention

Link to comment
Share on other sites

  • Moderators

odaylton,

I have tried to reproduce the problem using your code as a basis for my own script, but I cannot do so - the inputs lose highlight as soon as the focus changes. You will need to post a runnable example showing the problem so we can run it and try to debug - unfortunately a few scraps of code are just not enough to work with.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

4 hours ago, Melba23 said:

odaylton,

Tentei reproduzir o problema usando seu código como base para meu próprio script, mas não consigo fazer isso - as entradas perdem destaque assim que o foco muda. Você precisará postar um exemplo executável mostrando o problema para que possamos executá-lo e tentar depurar - infelizmente, alguns fragmentos de código não são suficientes para trabalhar.

M23

ok, i will try to generate a short listing
I created many different libraries for each type of control and thus unify and facilitate the assembly of "GUIs" is not mature enough to publish now...
I believe it must have something to do with Styles or events

Link to comment
Share on other sites

11 hours ago, Melba23 said:

odaylton,

I have tried to reproduce the problem using your code as a basis for my own script, but I cannot do so - the inputs lose highlight as soon as the focus changes. You will need to post a runnable example showing the problem so we can run it and try to debug - unfortunately a few scraps of code are just not enough to work with.

M23

sorry but in order to contain everything I had to put the necessary minimum

Global $Versao = 0
Global $NomeProjeto = "TesteBiblio"
Global $DirNomeProjeto = "testes"
Global $DescrProjeto = $NomeProjeto & @CRLF & "Testando Formularios com novas Biblios"
Global $Form[2][9]
$Form[0][0] = 1
$Form[$Form[0][0]][0] = WinGetHandle(AutoItWinGetTitle())
$Form[$Form[0][0]][1] = 800
$Form[$Form[0][0]][2] = 600
$Form[$Form[0][0]][3] = "RoboAutomato - " & $NomeProjeto
$Form[$Form[0][0]][4] = False
$Form[$Form[0][0]][5] = False
$Form[$Form[0][0]][6] = 0
$Form[$Form[0][0]][7] = 0
$Form[$Form[0][0]][8] = 0
Global $baseID = 10
Global $XMax = @DesktopWidth, $YMax = @DesktopHeight

Global $Contato = @CRLF & "A automção da automação criado por:" & @CRLF & "www.roboautomato.com.br (em constru��o)" & @CRLF & "Fone:  +55 (11) 9-9372-0074 TIM-Whats" & @CRLF & "E-mail: junior.prof@yahoo.com.br" & @TAB & "www.facebook.com/roboautomato" & @TAB & "Skype: junior.prof"

Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc")

Opt("TrayMenuMode", 3)
If @Compiled <> 1 Then
    Opt("TrayIconDebug", 1)
    Opt("TrayAutoPause", 1)
EndIf
Global $TrayTesto = "", $TrayTipTitulo = "", $TrayTipTesto = ""
$TrayTesto = $DescrProjeto & $Contato
TraySetToolTip($TrayTesto)
#Region Rotinas de Arquivos de variaveis BiBlio 21-08-02(sempre mostrar aqui a data de modifica��o)
;#include "E:\0MeusDocs\0Projetos\AutoIt\0Biblio\Fundamentais.au3"
#Region Includes
;para ToolTip
#include <GuiToolTip.au3>
#EndRegion Includes
#Region Projeto com formularios
;#include "E:\0MeusDocs\0Projetos\AutoIt\0Biblio\ParaForms.au3"
#Region Inludes nescessários
#include <WinAPI.au3>
#include <WinAPISys.au3>
#include <WinAPILocale.au3>
#include <WinAPIFiles.au3>

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
;para Abas
#include <GuiTab.au3>


#EndRegion Inludes nescessários
;21-08-14 ControlIndex[0][0]=IDAtual real do Autoit poi o ID é $iIDForm
Global $ControlIndex[$baseID][2] ;conterá o indice em função do ID da Janela
;ControlIndex[0][0]= não é a quant de controles e sim o IDAtual real do autoit
;ControlIndex[0][1]= não usado
;Note que em vez de usar um ID acima de 10.000 geraria uma matriz gigante e desnecessária
; em vez disso temos $baseID como o divizor de aguas onde abaixo de $baseID temos IDs normais e
;entre $baseID e UBound($ControlIndex, 1) os ids acima de 10.000
;Neste caso
;ControlIndex[XX][0]= onde XX é o ID modificado do controle
;ControlIndex[XX][1]=tipo de controle
;                   1 = Label
;                   2 =InputBox
;                   3= EditBox
;                   4= Combobox
;                   5= ListView
;                   6= TreeView <<<<<<<<<<<<<<<(não elaborado)
;                   9= Button
;                   10=Draw
;                   11=Imagens
;.....
;Para Janelas Filhas criar outro talvez

#EndRegion Projeto com formularios
#Region para Labels
;21-04-17 incerindo novos itens a Label
Global $Labels[2][4]
;$Labels[0][0]= LabelsQuant
;$Labels[0][1]= Max Pos Negativa X
;$Labels[0][2]= Max Pos Negativa Y
;$Labels[0][3]= disponivel
;$Labels[XX][0]= ID Labels
;$Labels[XX][1]= ID LabelsHandlePai se 0 Label individual mas não serve na criação
;$Labels[XX][2]= PosX apos Label
;$Labels[XX][3]= PosY Topo Label

;devolve ID do controle

;21-04-08 nova padroniza��o
;#include "E:\0MeusDocs\0Projetos\AutoIt\0Biblio\ParaControls.au3"
#include <EditConstants.au3>
#include <ComboConstants.au3>

#Region Includes para Forms
#Region fun�es para o CTRL
Func AcaoLabel($Indice, $ClickTipo)
    ;21-08-14 Obtem IDAtual
    If CtrlIDAtual($Labels[$Indice][0]) Then
        ;21-08-09 Obten dados genericos do objeto
        ;Disponivel para consulta
        Local $PosControle = ControlGetPos($Form[$Form[0][0]][0], "", $Labels[$Indice][0])
        Local $Mensagem = "O Campo [" & GUICtrlRead($Labels[$Indice][0]) & "] clicado:" & @CRLF & _
                "1 ou 2 clicks[" & $ClickTipo & "]" & @CRLF & _
                "PosCtrl[" & $Labels[$Indice][2] & "," & $Labels[$Indice][3] & "]" & @CRLF & _
                "Pos[" & $PosControle[0] & "," & $PosControle[1] & "][" & $PosControle[2] & "," & $PosControle[3] & "]" & @CRLF
        ;essa rotina concentra todas as atitides distintas para cada tipo de Label
        Switch $Indice
            Case 1 ; exempo de a��a para o indice 1 ou seja o primeiro input box
                ;MostraAcao("A��o do Label", _
                ;$Mensagem & "n�o gerou A��o, OK", _
                ;0, 2)
                GUICtrlSetState($Labels[$Indice][0], $GUI_FOCUS)

            Case Else

                ;MostraAcao("A��o do Label", _
                ;$Mensagem & "n�o gerou A��o, OK", _
                ;0, 2)
                ;PASSA O FOCO
                GUICtrlSetState($Labels[$Indice][0], $GUI_FOCUS)

        EndSwitch
    EndIf
EndFunc   ;==>AcaoLabel
;21-08-02 Separa��o das variaveis com as Biblios
;incerir somente aqueles que ser�o usados no projeto
#include "E:\0MeusDocs\0Projetos\AutoIt\0Biblio\02InputBoxVar.au3"
Func Acao02Input($Indice, $Valor)
    ;21-08-14 Obtem IDAtual
    If CtrlIDAtual($Inputs[$Indice][0]) Then
        ;21-08-09 Obten dados genericos do objeto
        ;Disponivel para consulta, no futuro poder� ser apenas em casos gen�ricos
        Local $PosControle = ControlGetPos($Form[$Form[0][0]][0], "", $Inputs[$Indice][0])
        Local $Mensagem = "O Campo [" & GUICtrlRead($Labels[$Inputs[$Indice][1]][0]) & "] foi alterado:" & @CRLF & _
                "[" & $Inputs[$Indice][9] & "] => [" & $Valor & "]" & @CRLF & _
                "Coordenadas Label[" & $Labels[$Inputs[$Indice][1]][2] & "," & $Labels[$Inputs[$Indice][1]][3] & "]" & @CRLF & _
                "      Pos[" & $PosControle[0] & "," & $PosControle[1] & "][" & $PosControle[2] & "," & $PosControle[3] & "]" & @CRLF

        ;;verifica se existe Bot�o vinculado
        ;if $Inputs[$Indice][10]<> 0 Then
        ;;obtendo dados de Bot�o Vinculado
        ;Local $PosButton=ControlGetPos("","",$Buttons[$Inputs[$Indice][10]][0])
        ;$Mensagem &= "ButtonPos["& $PosButton[0] &","& $PosButton[1] &"]["& $PosButton[2] &","& $PosButton[3] &"]"& @CRLF
        ;EndIf
        ;;essa rotina concentra todas as atitides distintas para cada tipo de ControlEnable
        Switch $Indice
            Case 1 ; exempo de a��a para o indice 1 ou seja o primeiro input box
                ;MostraAcao("A��o do InputBox", _
                ;$Mensagem & @CRLF & _
                ;"n�o gerou A��o, OK", _
                ;0, 2)
                ;21-06-18 para teste envia o dado para o ultimo InputBox
                GUICtrlSetData($Inputs[$Inputs[0][0]][0], $Valor)
            Case Else
                ;MostraAcao("A��o do InputBox", _
                ;$Mensagem & @CRLF & _
                ;"n�o gerou A��o, OK", _
                ;0, 2)
                MostraAcao("A��o do InputBox", _
                        $Mensagem)
        EndSwitch
    EndIf
EndFunc   ;==>Acao02Input
#EndRegion fun�es para o CTRL

;19-02-17 incerindo Bibliotecas de controles
;incerir somente aqueles que ser�o usados no projeto
;#include "E:\0MeusDocs\0Projetos\AutoIt\0Biblio\02InputBox.au3"
#Region interdependencia
;#include "E:\0MeusDocs\0Projetos\AutoIt\0Biblio\04Combobox.au3"
;#include "E:\0MeusDocs\0Projetos\AutoIt\0Biblio\dbidx.au3"
#EndRegion interdependencia
;#include "E:\0MeusDocs\0Projetos\AutoIt\0Biblio\09Button.au3"
;21-04-13 teste de nova biblio InputBox+Button Localizar
;#include "E:\0MeusDocs\0Projetos\AutoIt\0Biblio\XXOutrosProcurar.au3"

;21-04-17 modificado a posi��o
;#include "E:\0MeusDocs\0Projetos\AutoIt\0Biblio\VarArquivos de Dados.au3"
;18-12-05 inicio de uso da biblioteca para BD
;#include "E:\0MeusDocs\0Projetos\AutoIt\0Biblio\BD.au3"
;21-04-16 incerindo ListView
;#include "E:\0MeusDocs\0Projetos\AutoIt\0Biblio\05ListView.au3"

;21-04-16 incerindo TreeView
;#include "E:\0MeusDocs\0Projetos\AutoIt\0Biblio\06TreeView.au3"

#EndRegion Includes para Forms


#EndRegion para Labels


Func MostraAcao($AcaoTitulo = "", $AcaoTexto = "")
    If $AcaoTitulo = "" And $AcaoTexto = "" Then
        MostraAcaoFecha()
        Return
    EndIf
    ;...
    TrayTip($AcaoTitulo, $AcaoTexto, Default, 2)

    ;...
EndFunc   ;==>MostraAcao
Func MostraAcaoFecha($MostraAcaoFechaTexto = "")
    If $MostraAcaoFechaTexto = "" Then
        $MostraAcaoFechaTexto = $TrayTesto
    EndIf

    TrayTip("", "", 0)

EndFunc   ;==>MostraAcaoFecha
Func _WinWaitActivate($title, $text = "", $timeout = 20)
    If $timeout = 0 Then $timeout = 20
    If IsHWnd($title) Then
        $Titulo = WinGetTitle($title)
    Else
        $Titulo = $title
    EndIf
    MostraAcao("Esperando (" & $timeout & "s)...", "Janela [" & $Titulo & "]" & @CRLF & "Contendo[" & $text & "]")
    WinWait($title, $text, $timeout)
    If Not WinActive($title, $text) Then WinActivate($title, $text)
    $HandleWin = WinWaitActive($title, $text, $timeout)
    MostraAcao()
    $HandleWin = WinGetHandle("[ACTIVE]")
    Return $HandleWin
EndFunc   ;==>_WinWaitActivate

Global $XBorda = _WinAPI_GetSystemMetrics($SM_CXFRAME)
Global $YCaption = _WinAPI_GetSystemMetrics($SM_CYCAPTION)
Global $XIcon = _WinAPI_GetSystemMetrics($SM_CXICON)
Global $XCtrlNext = 0
Global $YCtrlNext = 0
Global $XCtrlAtual = 0
Global $YCtrlAtual = 0
Opt('WinWaitDelay', 50)
Opt('WinDetectHiddenText', 1)
Opt("WinSearchChildren", 1)
Opt("GUICloseOnESC", 0)
Global $MeuCoordMode = 1
Opt('MouseCoordMode', $MeuCoordMode)
Opt("PixelCoordMode", $MeuCoordMode)
Global $hGUIToolTip
Global $FormFonteTam = 12
Global $FormFonteTipo = 400
Global $FormFonteEstilo = 0
Global $FormFonteNome = "Arial"
GUISetFont($FormFonteTam, $FormFonteTipo, $FormFonteEstilo, $FormFonteNome)

Func CtrlIDAtual($IdAtual)
    $ControlIndex[0][0] = $IdAtual
    If $IdAtual >= $baseID Then
        $ControlIndex[0][0] = $IdAtual + 10000 - $baseID
    EndIf
    If UBound($ControlIndex, 1) <= $IdAtual Then
        If Not IsDeclared("iMsgBoxAnswer") Then Local $iMsgBoxAnswer
        $iMsgBoxAnswer = MsgBox(266260, "Indice indefinido", "O indice [" & $IdAtual & "] � maior que o limite [" & UBound($ControlIndex, 1) & "]." & @CRLF & "Analizar..." & @CRLF & "Sair ou n�o" & @CRLF, 5)
        If $iMsgBoxAnswer = 7 Then
            Return False
        Else
            Exit
        EndIf
    Else
        Return True
    EndIf
EndFunc   ;==>CtrlIDAtual
Func GetArea($text, $LabelTamFonteTemp, $LabelFonteTipoTemp, $LabelFonteEstiloTemp, $LabelFonteNomeTemp, $LabelEstiloTemp, $LabelEstiloExTemp)
    Local $LabelTemp = GUICtrlCreateLabel($text, 20, 20, Default, Default, $LabelEstiloTemp, $LabelEstiloExTemp)
    GUICtrlSetFont($LabelTemp, $LabelTamFonteTemp, $LabelFonteTipoTemp, $LabelFonteEstiloTemp, $LabelFonteNomeTemp)
    Local $hLabelTenp = GUICtrlGetHandle($LabelTemp)
    Local $hDC = _WinAPI_GetDC($hLabelTenp)
    Local $hFont = _SendMessage($hLabelTenp, $WM_GETFONT)
    Local $hSelectObject = _WinAPI_SelectObject($hDC, $hFont)
    Local $tSize = _WinAPI_GetTextExtentPoint32($hDC, $text)
    _WinAPI_SelectObject($hDC, $hSelectObject)
    _WinAPI_ReleaseDC($hLabelTenp, $hDC)
    Local $aReturn[2] = [DllStructGetData($tSize, 1), DllStructGetData($tSize, 2)]
    GUICtrlDelete($LabelTemp)
    Return $aReturn
EndFunc   ;==>GetArea

Func Ctrl02(ByRef $CntX2, ByRef $CntY2, ByRef $CntTamFonte2, ByRef $CntFonteTipo2, ByRef $CntFonteEstilo2, ByRef $CntFonteNome2)
    If $CntX2 = Default Then
        $CntX2 = $XCtrlNext
    EndIf
    If $CntY2 = Default Then
        $CntY2 = $YCtrlNext
    EndIf
    If $CntTamFonte2 = Default Then
        $CntTamFonte2 = $FormFonteTam
    EndIf
    If $CntFonteTipo2 = Default Then
        $CntFonteTipo2 = $FormFonteTipo
    EndIf
    If $CntFonteEstilo2 = Default Then
        $CntFonteEstilo2 = $FormFonteEstilo
    EndIf
    If $CntFonteNome2 = Default Then
        $CntFonteNome2 = $FormFonteNome
    EndIf
EndFunc   ;==>Ctrl02
Func Ctrl01($CntTipo, ByRef $CntX, ByRef $CntY, ByRef $CntWidth, ByRef $CntHeight, ByRef $CntRotulo, ByRef $CntTip, ByRef $CntDefault, ByRef $CntAlin, ByRef $CntMascara, ByRef $CntEstilo, ByRef $CntEstiloEx, ByRef $CntResizing, ByRef $CntTamFonte, ByRef $CntFonteTipo, ByRef $CntFonteEstilo, ByRef $CntFonteNome, ByRef $Funcoes, ByRef $Mascara5)
    Ctrl02($CntX, $CntY, $CntTamFonte, $CntFonteTipo, $CntFonteEstilo, $CntFonteNome)
    If $CntMascara = Default Then
        $CntMascara = "CCCCCCCCCC"
        $Mascara5 = "__________"
    Else
        If $CntMascara <> "" Then
            $Mascara5 = ""
            Local $s = StringSplit($CntMascara, "")
            Local $temp = ""
            For $i = 1 To $s[0]
                If $s[$i] = "\" Then
                    If StringLen($temp) <> 0 Then
                        $Mascara5 &= StringRegExpReplace($temp, "[LAaC&?*09#]", "_")
                    EndIf
                    $Mascara5 &= $s[$i + 1]
                    $i += 1
                    $temp = ""
                    If $i > $s[0] Then ExitLoop
                Else
                    If $s[$i] = ">" Or $s[$i] = "<" Or $s[$i] = "!" Or $s[$i] = "*" Then
                        $Funcoes &= $s[$i]
                    Else
                        $temp &= $s[$i]
                    EndIf
                EndIf
            Next
            $Mascara5 &= StringRegExpReplace($temp, "[LAaC&?*09#]", "_")
        EndIf
    EndIf
    If $Funcoes <> "" Then
        If $CntEstilo <> Default Then
            $CntEstilo = Default
        EndIf
    EndIf
    If $CntEstilo = Default Then
        Switch $CntTipo
            Case 2
                $CntEstilo = BitOR($ES_AUTOHSCROLL, $WS_TABSTOP)
            Case 3
                $CntEstilo = BitOR($ES_AUTOHSCROLL, $WS_VSCROLL, $WS_TABSTOP)
            Case 4
                $CntEstilo = BitOR($CBS_DROPDOWN, $WS_VSCROLL, $CBS_AUTOHSCROLL, $CBS_SORT)
        EndSwitch
        If $Funcoes <> "" Then
            If StringInStr($Funcoes, "!") Then
                $CntEstilo = BitOR($CntEstilo, $ES_RIGHT)
            Else
                $CntEstilo = BitOR($CntEstilo, $ES_LEFT)
            EndIf
            If StringInStr($Funcoes, "<") Then
                $CntEstilo = BitOR($CntEstilo, $ES_LOWERCASE)
            EndIf
            If StringInStr($Funcoes, ">") Then
                $CntEstilo = BitOR($CntEstilo, $ES_UPPERCASE)
            EndIf
            If StringInStr($Mascara5, "*") Then
                $CntEstilo = BitOR($CntEstilo, $ES_PASSWORD)
            EndIf
        Else
            $CntEstilo = BitOR($CntEstilo, $ES_LEFT)
        EndIf
    EndIf
    If $CntEstiloEx = Default Then
        $CntEstiloEx = $WS_EX_CLIENTEDGE
    EndIf
EndFunc   ;==>Ctrl01
Func Ctrl03($CntTipo, ByRef $CntX, ByRef $CntY, ByRef $CntWidth, ByRef $CntHeight, ByRef $CntRotulo, ByRef $CntTip, ByRef $CntDefault, ByRef $CntAlin, ByRef $CntMascara, ByRef $CntEstilo, ByRef $CntEstiloEx, ByRef $CntResizing, ByRef $CntResizingBKP, ByRef $CntTamFonte, ByRef $CntFonteTipo, ByRef $CntFonteEstilo, ByRef $CntFonteNome, ByRef $Funcoes, ByRef $Mascara5)
    Local $RotuloArea[] = [0, 0]
    If $CntRotulo <> "" Then
        $RotuloArea = GetArea($CntRotulo, $CntTamFonte, $CntFonteTipo, $CntFonteEstilo, $CntFonteNome, Default, Default)
    EndIf
    Local $CntArea[] = [0, 0, 0, 0]
    Local $PreArea[] = [0, 0]
    If $CntWidth = Default Or $CntHeight = Default Then
        If StringLen($Mascara5) > StringLen($CntDefault) Then
            $PreArea = GetArea(StringRegExpReplace($Mascara5, "[_]", "_"), $CntTamFonte, $CntFonteTipo, $CntFonteEstilo, $CntFonteNome, Default, Default)
        Else
            If $CntDefault <> "" Then
                $PreArea = GetArea(StringRegExpReplace($CntDefault, "[a-zA-Z0-9_]", "_"), $CntTamFonte, $CntFonteTipo, $CntFonteEstilo, $CntFonteNome, Default, Default)
            Else
                $PreArea = GetArea("CCCCCCCCCCCCCCCCCCCC", $CntTamFonte, $CntFonteTipo, $CntFonteEstilo, $CntFonteNome, Default, Default)
            EndIf
        EndIf
    Else
        $PreArea[0] = $CntWidth
        $PreArea[1] = $CntHeight
    EndIf
    $CntArea[0] = $PreArea[0]
    $CntArea[1] = $PreArea[1]
    Local $CntFolga = 0
    If BitAND($CntEstilo, $SS_SUNKEN) Then
        $CntFolga = $XBorda
    Else
        $CntFolga = 0
    EndIf
    If BitAND($CntEstiloEx, $WS_EX_CLIENTEDGE) Then
        $CntFolga = $XBorda + 1
    Else
        $CntFolga = 0
    EndIf
    Local $PreResizing = 0
    If $CntX < 0 Then
        If $CntResizingBKP = Default Then
            $CntResizingBKP = BitOR($GUI_DOCKRIGHT, $GUI_DOCKTOP, $GUI_DOCKWIDTH, $GUI_DOCKHEIGHT)
        Else
            If BitAND($CntResizingBKP, $GUI_DOCKLEFT) Then
                $CntResizingBKP -= $GUI_DOCKLEFT
            EndIf
        EndIf
        If $CntTipo = 4 Then
            $CntX = $Form[$Form[0][0]][1] - $CntArea[0] - $XBorda - $YCaption
        Else
            $CntX = $Form[$Form[0][0]][1] - $CntArea[0] - $XBorda
        EndIf
        $PreResizing = $GUI_DOCKLEFT
    EndIf
    If $CntX <> 0 And $CntX = $XCtrlAtual Then
        $CntY += $RotuloArea[1]
    EndIf
    If $CntY <> 0 And $CntY = $YCtrlAtual Then
        $CntX += $RotuloArea[0]
    EndIf
    If $CntWidth < 0 Then
        Switch $CntAlin
            Case 1, 2, 3
                If $CntTipo = 4 Then
                    $CntWidth = $Form[$Form[0][0]][1] + $CntWidth - $CntX + $YCaption
                Else
                    $CntWidth = $Form[$Form[0][0]][1] + $CntWidth - $CntX
                EndIf
            Case Else
                If $CntTipo = 4 Then
                    $CntWidth = $Form[$Form[0][0]][1] + $CntWidth - $CntX
                Else
                    $CntWidth = $Form[$Form[0][0]][1] + $CntWidth - $CntX - $RotuloArea[0]
                EndIf
        EndSwitch
        $CntArea[0] = $CntWidth - $CntFolga
        If $CntResizing = Default Then
            $PreResizing = $GUI_DOCKRIGHT
        EndIf
    Else
        If $CntWidth = Default Then
            $CntWidth = $CntArea[0] + $CntFolga
            If $CntWidth > ($Form[$Form[0][0]][1] - $CntX) Then
                $CntWidth = ($Form[$Form[0][0]][1] - $CntX - $CntFolga * 2)
            EndIf
        Else
            $CntArea[0] = $CntWidth - $CntFolga
        EndIf
        If $CntTipo = 4 Then
            $CntWidth += $YCaption
        EndIf
    EndIf
    If $CntHeight < 0 Then
        $CntHeight = $Form[$Form[0][0]][2] + $CntHeight - $CntY
        $CntArea[1] = $CntHeight - $CntFolga
        If $CntResizing = Default Then
            $PreResizing += $GUI_DOCKBOTTOM
        EndIf
    Else
        If $CntHeight = Default Then
            $CntHeight = $CntArea[1] + $CntFolga
        Else
            $CntArea[1] = $CntHeight - $CntFolga
        EndIf
    EndIf
    If $PreResizing <> 0 Then
        Switch $PreResizing
            Case BitAND($PreResizing, $GUI_DOCKLEFT)
                $CntResizing = BitOR($GUI_DOCKRIGHT, $GUI_DOCKTOP, $GUI_DOCKBOTTOM, $GUI_DOCKWIDTH, $GUI_DOCKHEIGHT)
            Case BitAND($PreResizing, $GUI_DOCKRIGHT)
                $CntResizing = BitOR($GUI_DOCKLEFT, $GUI_DOCKRIGHT, $GUI_DOCKTOP, $GUI_DOCKWIDTH, $GUI_DOCKHEIGHT)
            Case BitAND($PreResizing, $GUI_DOCKBOTTOM)
                $CntResizing = BitOR($GUI_DOCKLEFT, $GUI_DOCKTOP, $GUI_DOCKBOTTOM, $GUI_DOCKWIDTH, $GUI_DOCKHEIGHT)
            Case Else
                $CntResizing = BitOR($GUI_DOCKLEFT, $GUI_DOCKRIGHT, $GUI_DOCKTOP, $GUI_DOCKBOTTOM, $GUI_DOCKWIDTH, $GUI_DOCKHEIGHT)
        EndSwitch
    EndIf
    If $CntResizing = Default Then
        $CntResizing = BitOR($GUI_DOCKLEFT, $GUI_DOCKTOP, $GUI_DOCKWIDTH, $GUI_DOCKHEIGHT)
    EndIf
    If $CntResizingBKP = Default Then
        $CntResizingBKP = BitOR($GUI_DOCKLEFT, $GUI_DOCKTOP, $GUI_DOCKWIDTH, $GUI_DOCKHEIGHT)
    EndIf
    If $CntRotulo <> "" Then
        Local $meiaFolga = $CntFolga / 2
        Switch $CntAlin
            Case 1
                $CntArea[2] = $CntX
                $CntArea[3] = $CntY + $RotuloArea[1] + $meiaFolga
                $CntY += $RotuloArea[1]
            Case 2
                $CntArea[2] = $CntX + ($CntArea[0] / 2)
                $CntArea[3] = $CntY + $RotuloArea[1] + $meiaFolga
                $CntY += $RotuloArea[1]
            Case 3
                $CntArea[2] = $CntX + $CntFolga + $CntArea[0]
                $CntArea[3] = $CntY + $RotuloArea[1] + $meiaFolga
                $CntY += $RotuloArea[1]
            Case 4
                If $CntX < ($RotuloArea[0] - $CntFolga) Then $CntX = $RotuloArea[0] - $CntFolga
                $CntArea[2] = $CntX
                $CntArea[3] = $CntY + $meiaFolga
            Case 5
                If $CntX < ($RotuloArea[0] - $CntFolga) Then $CntX = $RotuloArea[0] - $CntFolga
                $CntArea[2] = $CntX
                $CntArea[3] = $CntY + $meiaFolga
            Case Else
                If $CntX < $RotuloArea[0] Then $CntX = $RotuloArea[0]
                $CntArea[2] = $CntX
                $CntArea[3] = $CntY + $meiaFolga
        EndSwitch
    EndIf
    If $CntAlin = 4 Then
        $CntHeight += $CntFolga * 3
    EndIf
    If $CntAlin = 5 Then
        $CntX += $RotuloArea[0]
        $CntWidth -= ($RotuloArea[0] + $CntFolga)
    EndIf
    If $CntTipo = 4 Then
        $XCtrlNext = $CntX + $CntArea[0] + ($CntFolga * 2) + $YCaption
        If $XCtrlNext > $Form[$Form[0][0]][1] Then $XCtrlNext = 0
        $YCtrlNext = $CntY + $CntArea[1] + ($CntFolga * 2)
    Else
        $XCtrlNext = $CntX + $CntArea[0] + ($CntFolga)
        If $XCtrlNext > $Form[$Form[0][0]][1] Then $XCtrlNext = 0
        $YCtrlNext = $CntY + $CntArea[1] + ($CntFolga)
    EndIf
    $XCtrlAtual = $CntX
    $YCtrlAtual = $CntY
    Return $CntArea
EndFunc   ;==>Ctrl03
Global $hJanDebug

If @Compiled <> 1 Then

    Run("notepad.exe")
    $hJanDebug = WinWait("[CLASS:Notepad]")
EndIf
Func _DebugPrint($s_Text, $sLine = @ScriptLineNumber)
    If @Compiled <> 1 Then
        If $sLine <> "" Then
            $dado = "+======================================================" & @CRLF & @HOUR & ":" & @MIN & ":" & @SEC & "-Linha: " & StringFormat("%04d", $sLine) & @CRLF & $s_Text & @CRLF & "+======================================================"
        Else
            $dado = $s_Text
        EndIf
        If Not (WinExists("[CLASS:Notepad]")) Then
            Run("notepad.exe")
            $hJanDebug = WinWait("[CLASS:Notepad]")
        EndIf
        SendKeepActive($hJanDebug)
        ControlSend($hJanDebug, "", "Edit1", $dado)
        ControlSend($hJanDebug, "", "Edit1", "{ENTER}")
        SendKeepActive("")
    EndIf
EndFunc   ;==>_DebugPrint

Func LabelCriar($LabelX, $LabelY, _  ;Coordenadas Base Neste caso é obrigatorio X e Y
        $LabelRotulo, _              ;Rotulo da Label obrigatorio
        $LabelTip = "", _            ;Texto explicativo do InputBox e seu label
        $LabelAlin = Default, _      ;0 é Default ou define o tipo de alinhamento
        $LabelEstilo = Default, _    ;Estilo label
        $LabelEstiloEx = Default, _ ;Estilo ext label
        $LabelResizing = Default, _ ; Tipo de alinhamento em relação a Janela
        $LabelTamFonte = Default, _      ;Tamanho da Fonte
        $LabelFonteTipo = Default, _     ;Tipo da Fonte
        $LabelFonteEstilo = Default, _   ;Estilo da Fonte
        $LabelFonteNome = Default) ; Nome da Fonte
    ;21-08-10 por padão a lable não modifica as posições  dos controles
    Local $LabelCoordX = False
    Local $LabelCoordY = False
    ;21-08-29 deu merda
    ;21-08-10 se for a primeira labelfixar as cooedenadas iniciais
    ;If $Labels[0][0] = 0 Then
    ;   $XCtrlNext = $LabelX
    ;   $YCtrlNext = $LabelY
    ;verificar se isso vai dar MERDA<<<<<<<<
    ;EndIf

    ;$LabelAlin= define tipos especificos de alinhamentos para um Label de um controle
    ;           =0 ou Default cria um Rotulo para um Campo (o texto esta alinhado a direita)
    ;           =1 cria um Rotulo superior ao Campo(o texto esta alinhado a esquerda)
    ;           =2 cria um Rotulo superior ao Campo(o texto esta centralizado)
    ;               Neste Caso as coordenadas X devem ser a metade do comprimento do Campo
    ;           =3 cria um Rotulo superior ao Campo(o texto esta aqlinhado a direita)
    ;               Neste Caso as coordenadas X devem do comprimento do Campo
    ;           =4 cria um layout de InputBox falso
    ;21-08-14 testando estilo=Default realmente não funciona
    If $LabelEstilo = Default Then
        $LabelEstilo = BitOR($SS_NOTIFY, $SS_LEFT)
    EndIf
    ;1) Criar uma Label para definir o tamanho da Fonte
    ;mesmo se $LabelRotulo="" pois iso indica que será atualizado depois<<<<<<<<<<<< elaborar
    #Region Inicializando Default
    ;1) coordenadas (neste Caso não aplicado
    ;21-08-10 teatando no caso de labels com coordenadas defaut
    ;Copiando Ctrl02 pois se não da problema na ordem das libs
    ;Ctrl02($LabelX, $LabelY, _  ;Coordenadas Base Neste caso é obrigatorio X e Y
    ;$LabelTamFonte = Default, _     ;Tamanho da Fonte
    ;$LabelFonteTipo = Default, _    ;Tipo da Fonte
    ;$LabelFonteEstilo = Default, _      ;Estilo da Fonte
    ;$LabelFonteNome = Default) ; Nome da Fonte
    ;Coordenadas Iniciais
    If $LabelX = Default Then
        $LabelX = $XCtrlNext
        ; label isolada
        $LabelCoordX = True ; permite repassar as coordenadas  para o proximo campo
    EndIf
    If $LabelY = Default Then
        $LabelY = $YCtrlNext
        ; label isolada
        $LabelCoordY = True ; permite repassar as coordenadas  para o proximo campo
    EndIf
    #Region fontes do Form antes de definir areas

    If $LabelTamFonte = Default Then
        $LabelTamFonte = $FormFonteTam
    EndIf

    If $LabelFonteTipo = Default Then
        $LabelFonteTipo = $FormFonteTipo
    EndIf

    If $LabelFonteEstilo = Default Then
        $LabelFonteEstilo = $FormFonteEstilo
    EndIf

    If $LabelFonteNome = Default Then
        $LabelFonteNome = $FormFonteNome
    EndIf
    #EndRegion fontes do Form antes de definir areas
    Local $LabelFolga = 0


    #EndRegion Inicializando Default

    #Region Ajusta tamanho e posição



    $LabelArea = GetArea($LabelRotulo, _
            $LabelTamFonte, _
            $LabelFonteTipo, _
            $LabelFonteEstilo, _
            $LabelFonteNome, _
            $LabelEstilo, _ ;Estilo
            $LabelEstiloEx) ;Extilo extra

    ;If $LabelEstilo = Default Then $LabelEstilo = $SS_NOTIFY
    Switch $LabelAlin

        Case 1
            ;Texto sobre o Campo Alinhado ao canto inferior Esquerdo
            $LabelY = $LabelY - $LabelArea[1]
            ;Texto Alinhado a Direita
            $LabelEstilo = BitOR($SS_LEFT, $LabelEstilo)
        Case 2
            ;Texto sobre o Campo Centralizado ao canto Superor Esquerdo do Campo
            ;Neste Caso o $LabelX deve ser o Centro do Campo que contem o Rotulo
            $LabelX = $LabelX - $LabelArea[0] / 2
            $LabelY = $LabelY - $LabelArea[1]

            ;Texto Alinhado a Direita
            $LabelEstilo = BitOR($SS_CENTER, $LabelEstilo)
        Case 3
            ;Texto alinhado ao canto superior direito
            $LabelX = $LabelX - $LabelArea[0]
            $LabelY = $LabelY - $LabelArea[1]
            ;Texto Alinhado a Direita
            $LabelEstilo = BitOR($SS_RIGHT, $LabelEstilo)
        Case 4
            ;layout tipo Flaso InputBox
            $LabelFolga = 4
            ;Texto alinhado ao canto superior direito
            $LabelX = $LabelX - $LabelArea[0]
            $LabelY = $LabelY - 2
            $LabelArea[1] += 4 ; folga
            $LabelEstilo = BitOR($SS_RIGHT, $SS_SUNKEN, $LabelEstilo)
            ;$LabelEstiloEx =  $WS_EX_CLIENTEDGE
        Case 5
            ;19-10-21 o campo fica alinhado apos o rotulo
            ;alinhado a esquerda
            $LabelEstilo = BitOR($SS_RIGHT, $LabelEstilo)
        Case Else
            ;Case Default
            ;Texto alinhado ao canto superior direito
            $LabelX = $LabelX - $LabelArea[0]
            ;Texto Alinhado a Direita
            $LabelEstilo = BitOR($SS_RIGHT, $LabelEstilo)
    EndSwitch
    ;19-03-20 reposicionando Folga
    If BitAND($LabelEstilo, $SS_SUNKEN) Then
        $LabelFolga = 4
    Else
        $LabelFolga = 0
    EndIf
    If $LabelResizing = Default Then
        $LabelResizing = BitOR($GUI_DOCKLEFT, $GUI_DOCKTOP, $GUI_DOCKWIDTH, $GUI_DOCKHEIGHT)
    EndIf
    #EndRegion Ajusta tamanho e posição
    #Region Montagem Final
    $Labels[0][0] += 1
    If UBound($Labels, 1) = $Labels[0][0] Then
        Local $Quant = $Labels[0][0]
        ;21-09-01 PADRONIZAR
        Local $Quant2D = UBound($Labels, 2)
        ReDim $Labels[$Quant + 1][$Quant2D]
        ;ReDim $Labels[$Quant + 1][4]
    EndIf
    If $LabelX < 0 Then
        If $Labels[0][1] > $LabelX Then
            $Labels[0][1] = $LabelX
        EndIf
        #Region --- CodeWizard generated code Start ---
        ;MsgBox features: Title=Yes, Text=Yes, Buttons=OK, Icon=Question, Modality=System Modal, Timeout=10 ss
        If Not IsDeclared("iMsgBoxAnswer") Then Local $iMsgBoxAnswer
        $iMsgBoxAnswer = MsgBox(4128, "Falha de montagem", _
                "O Rotulo [" & $LabelRotulo & "] esta fora da janela  por [" & Abs($LabelX) & "] pixels ." & @CRLF & _
                "Favor na proxima montagem do programa corrigir isso" & @CRLF & _
                "Maior Valor negativo é de [" & Abs($Labels[0][1]) & "]", 10)

        ;Select
        ;Case $iMsgBoxAnswer = -1 ;Timeout
        ;Case Else                ;OK
        ;EndSelect
        #EndRegion --- CodeWizard generated code Start ---
        ;21-08-10 Incerindo os dados de posição na Tip quando fora da tela
        $LabelTip &= "Fora (" & $LabelX & "," & $LabelY & ")"
    EndIf
    ;21-08-10 fazendo em Y
    If $LabelY < 0 Then
        If $Labels[0][2] > $LabelY Then
            $Labels[0][2] = $LabelY
        EndIf
        ;zerando
        $LabelY = 0
        #Region --- CodeWizard generated code Start ---
        ;MsgBox features: Title=Yes, Text=Yes, Buttons=OK, Icon=Question, Modality=System Modal, Timeout=10 ss
        If Not IsDeclared("iMsgBoxAnswer") Then Local $iMsgBoxAnswer
        $iMsgBoxAnswer = MsgBox(4128, "Falha de montagem", _
                "O Rotulo [" & $LabelRotulo & "] esta fora da janela  por [" & Abs($LabelX) & "] pixels ." & @CRLF & _
                "Favor na proxima montagem do programa corrigir isso" & @CRLF & _
                "Maior Valor negativo é de [" & Abs($Labels[0][1]) & "]", 10)

        ;Select
        ;Case $iMsgBoxAnswer = -1 ;Timeout
        ;Case Else                ;OK
        ;EndSelect
        #EndRegion --- CodeWizard generated code Start ---
        ;21-08-10 Incerindo os dados de posição na Tip quando fora da tela
        $LabelTip &= "Fora (" & $LabelX & "," & $LabelY & ")"
    EndIf
    ;21-09-05 mudando base de referencia para a area atual do controle
    $Labels[$Labels[0][0]][0] = GUICtrlCreateLabel($LabelRotulo, _
            $Form[$Form[0][0]][6] + $LabelX, $Form[$Form[0][0]][7] + $LabelY, _      ;adicionando o ponto de referencia
            $LabelArea[0] + $LabelFolga, $LabelArea[1] + $LabelFolga, _
            $LabelEstilo, _ ;Estilo
            $LabelEstiloEx) ;Extilo extra
    ;21-04-17 fixando a posição superior direita da label (usado em TreeViel pra criar um botão
    $Labels[$Labels[0][0]][2] = $LabelX + $LabelArea[0] + $LabelFolga
    $Labels[$Labels[0][0]][3] = $LabelY
    ;19-02-17 definindo duplo click para o label
    Indexar($Labels[$Labels[0][0]][0], $Labels[0][0], 1) ;tipo label
    GUICtrlSetFont($Labels[$Labels[0][0]][0], _
            $LabelTamFonte, _
            $LabelFonteTipo, _
            $LabelFonteEstilo, _
            $LabelFonteNome)

    GUICtrlSetResizing($Labels[$Labels[0][0]][0], _
            $LabelResizing)
    $hLabel = GUICtrlGetHandle($Labels[$Labels[0][0]][0])
    If $LabelTip <> "" Then _GUIToolTip_AddTool($hGUIToolTip, $Form[$Form[0][0]][0], $LabelTip, $hLabel)
    ;19-02-17 não usar OnEvent
    ;GUICtrlSetOnEvent($Labels[$Labels[0][0]][0], "LabelPassaFoco")
    #EndRegion Montagem Final
    ;21-08-10 nos casos que as coordenadas são Default temos que atualizar as coordenadas ultimas

    If $LabelCoordX Then
        $XCtrlNext = $LabelX + $LabelArea[0] + ($LabelFolga) ;+$CntArea[2] ; 21-04-13 ta errado??? tudo Default menos a largura do InputBox
    EndIf
    If $LabelCoordY Then
        ;21-04-16 caso estore o tamanho da janela gera uma quebra de linha
        If $XCtrlNext > $Form[$Form[0][0]][1] Then $XCtrlNext = 0
        $YCtrlNext = $LabelY + $LabelArea[1] + ($LabelFolga) ;+$CntArea[3]
    EndIf
    ;AutoIt_Debugger_Command:Disable_Debug
    ;19-02-18 tem que devolver o indice para obter o ID e colocar [1]
    Return $Labels[0][0]
EndFunc   ;==>LabelCriar
Func CommandsLabel($iCode, $iIDFrom, $hWndFrom, $sResumo)
    $sText = "Label: "
    Switch $iCode

        Case 0, 1 ;click                    Case 1  ;duplo click
            If CtrlIDAtual($iIDFrom) Then
                If $Labels[$ControlIndex[$iIDFrom][0]][1] <> "" Then
                    ;passar o foco para o controle Pai
                    ;MsgBox(0, "Passando o foco", _
                    ;"WM_COMMAND - Infos: ID >[" & UBound($ControlIndex)-1 & "]" & @CRLF & _
                    ;"-----------------------------" & @CRLF & _
                    ;$sResumo)
                    GUICtrlSetState($Labels[$ControlIndex[$iIDFrom][0]][1], $GUI_FOCUS)
                Else
                    AcaoLabel($ControlIndex[$iIDFrom][0], $iCode + 1)
                EndIf
            EndIf
            Return 0
        Case Else
            _DebugPrint("-----------------------------" & @CRLF & _
                    "WM_COMMAND Ação não definida para (" & $sText & ")" & @CRLF & _
                    "-----------------------------" & @CRLF & _
                    $sResumo)
            Return 0 ; Only workout clicking on the button

    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc   ;==>CommandsLabel

Func Indexar($IndexarIndice, $IndexarValor, $IndexarTipo)
    ;21-04-21 diminuindo o indice de 10000 para $baseID
    If $IndexarIndice > 9999 Then
        $IndexarIndice = $baseID + $IndexarIndice - 10000
    Else
        If $IndexarIndice > $baseID Then
            ;temos que reindexar todos os itens para um novo patamar
            $LimiteAtual = UBound($ControlIndex, 1) - 1
            ;1) almentar o limite 10 IDs
            ReDim $ControlIndex[$baseID + $LimiteAtual + 11][2]
            ;desloca os IDs para o novo ponto de divisão subindo em 10 a tabela
            For $iIndexar = 1 To 10
                $ControlIndex[$baseID + $iIndexar + $LimiteAtual][0] = $ControlIndex[$baseID + $iIndexar][0]
                $ControlIndex[$baseID + $iIndexar + $LimiteAtual][1] = $ControlIndex[$baseID + $iIndexar][1]
            Next
            $baseID += 10
        EndIf
    EndIf
    ;19-11-03 erro de matriz
    If UBound($ControlIndex, 1) <= $IndexarIndice Then
        ;Local $Quant = $IndexarIndice
        ReDim $ControlIndex[$IndexarIndice + 1][2]
    EndIf
    $ControlIndex[$IndexarIndice][0] = $IndexarValor
    $ControlIndex[$IndexarIndice][1] = $IndexarTipo

EndFunc   ;==>Indexar



Func InputCriar($InputX = Default, $InputY = Default, $InputWidth = Default, $InputHeight = Default, $InputRotulo = "", $InputTip = "", $InputDefault = "", $InputAlin = Default, $InputMascara = Default, $InputEstilo = Default, $InputEstiloEx = Default, $InputResizing = Default, $InputTamFonte = Default, $InputFonteTipo = Default, $InputFonteEstilo = Default, $InputFonteNome = Default)
    Local $Funcoes
    Local $Mascara5
    If $InputEstilo = Default Then
        $InputEstilo = BitOR($ES_LEFT, $WS_TABSTOP, $SS_NOTIFY)
    EndIf
    If $InputEstiloEx = Default Then
        $InputEstiloEx = $WS_EX_CLIENTEDGE
    EndIf
    Local $FuncRet = Ctrl01(2, $InputX, $InputY, $InputWidth, $InputHeight, $InputRotulo, $InputTip, $InputDefault, $InputAlin, $InputMascara, $InputEstilo, $InputEstiloEx, $InputResizing, $InputTamFonte, $InputFonteTipo, $InputFonteEstilo, $InputFonteNome, $Funcoes, $Mascara5)
    $Inputs[0][0] += 1
    If UBound($Inputs, 1) = $Inputs[0][0] Then
        Local $Quant = $Inputs[0][0]
        Local $Quant2D = UBound($Inputs, 2)
        ReDim $Inputs[$Quant + 1][$Quant2D]
    EndIf
    Local $InputResizingBKP = $InputResizing
    Local $InputArea = Ctrl03(2, $InputX, $InputY, $InputWidth, $InputHeight, $InputRotulo, $InputTip, $InputDefault, $InputAlin, $InputMascara, $InputEstilo, $InputEstiloEx, $InputResizing, $InputResizingBKP, $InputTamFonte, $InputFonteTipo, $InputFonteEstilo, $InputFonteNome, $Funcoes, $Mascara5)
    Local $InputLabelCreate = 0
    Switch $InputAlin
        Case 1, 2, 3
            $InputLabelCreate = LabelCriar($InputArea[2], $InputArea[3], $InputRotulo, $InputTip, $InputAlin, Default, Default, $InputResizing, $InputTamFonte, $InputFonteTipo, $InputFonteEstilo, $InputFonteNome)
        Case Else
            $InputLabelCreate = LabelCriar($InputArea[2], $InputArea[3], $InputRotulo, $InputTip, $InputAlin, Default, Default, $InputResizingBKP, $InputTamFonte, $InputFonteTipo, $InputFonteEstilo, $InputFonteNome)
    EndSwitch
    $Inputs[$Inputs[0][0]][1] = $InputLabelCreate
    $Inputs[$Inputs[0][0]][8] = GUICtrlGetHandle($Inputs[$Inputs[0][0]][1])
    _GUIToolTip_AddTool($hGUIToolTip, $Form[$Form[0][0]][0], $InputTip, $Inputs[$Inputs[0][0]][8])
    $Inputs[$Inputs[0][0]][0] = GUICtrlCreateInput($Mascara5, $Form[$Form[0][0]][6] + $InputX, $Form[$Form[0][0]][7] + $InputY, $InputWidth, $InputHeight, $InputEstilo, $InputEstiloEx)
    Indexar($Inputs[$Inputs[0][0]][0], $Inputs[0][0], 2)
    If $InputRotulo <> "" Then
        $Labels[$Inputs[$Inputs[0][0]][1]][1] = $Inputs[$Inputs[0][0]][0]
    EndIf
    GUICtrlSetFont($Inputs[$Inputs[0][0]][0], $InputTamFonte, $InputFonteTipo, $InputFonteEstilo, $InputFonteNome)
    GUICtrlSetResizing($Inputs[$Inputs[0][0]][0], $InputResizing)
    $Inputs[$Inputs[0][0]][5] = $InputMascara
    $Inputs[$Inputs[0][0]][6] = $FuncRet
    If StringInStr($Inputs[$Inputs[0][0]][6], "!") Then
        $Inputs[$Inputs[0][0]][4] = -StringLen($Inputs[$Inputs[0][0]][5])
    Else
        $Inputs[$Inputs[0][0]][4] = 1
    EndIf
    If $InputDefault <> "" Then
        $Inputs[$Inputs[0][0]][3] = $InputDefault
    EndIf
    $Inputs[$Inputs[0][0]][7] = GUICtrlGetHandle($Inputs[$Inputs[0][0]][0])
    _GUIToolTip_AddTool($hGUIToolTip, $Form[$Form[0][0]][0], $InputTip, $Inputs[$Inputs[0][0]][7])
    GUICtrlSetData($Inputs[$Inputs[0][0]][0], $Inputs[$Inputs[0][0]][3])
    Return $Inputs[$Inputs[0][0]][0]
EndFunc   ;==>InputCriar
Func CommandsInputBox($iCode, $iIDFrom, $hWndFrom, $sResumo)
    $sText = "InputBox: "
    If CtrlIDAtual($iIDFrom) Then
        Switch $iCode
            Case 768
                $sText &= "$IN_CHANGE"
            Case 1024
                $sText &= "$IN_UPDATE"
            Case 256
                $Inputs[$ControlIndex[$iIDFrom][0]][9] = GUICtrlRead($Inputs[$ControlIndex[$iIDFrom][0]][0])
            Case 512
                Local $InputNow = GUICtrlRead($Inputs[$ControlIndex[$iIDFrom][0]][0])
                If $Inputs[$ControlIndex[$iIDFrom][0]][9] <> $InputNow Then
                    GUICtrlSetState($Inputs[$ControlIndex[$iIDFrom][0]][0], 128)
                    Acao02Input($ControlIndex[$iIDFrom][0], $InputNow)
                    GUICtrlSetState($Inputs[$ControlIndex[$iIDFrom][0]][0], 64)
                    $Inputs[$ControlIndex[$iIDFrom][0]][9] = $InputNow
                EndIf
            Case Else
                _DebugPrint("-----------------------------" & @CRLF & "WM_COMMAND A��o n�o definida para (" & $sText & ")" & @CRLF & "-----------------------------" & @CRLF & $sResumo)
        EndSwitch
    EndIf
    Return $GUI_RUNDEFMSG
EndFunc   ;==>CommandsInputBox
OnAutoItExitRegister('AutoItExit')

Func AutoItExit()
    BlockInput(0)
    GUIDelete($Form[$Form[0][0]][0])
    Exit (0)
EndFunc   ;==>AutoItExit
Opt("TrayMenuMode", 3)
Opt("TrayOnEventMode", 1)
#EndRegion Rotinas de Arquivos de variaveis BiBlio 21-08-02(sempre mostrar aqui a data de modifica��o)
Example()
Func Example()
    $Form[$Form[0][0]][0] = GUICreate($Form[$Form[0][0]][3], $Form[$Form[0][0]][1], $Form[$Form[0][0]][2], Default, Default, BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_SIZEBOX, $WS_THICKFRAME, $WS_TABSTOP, $WS_POPUP))
    GUISetFont($FormFonteTam, $FormFonteTipo, $FormFonteEstilo, $FormFonteNome)
    $hGUIToolTip = _GUIToolTip_Create($Form[$Form[0][0]][0], BitOR($_TT_ghTTDefaultStyle, $TTS_BALLOON))
    InputCriar(250, 200, Default, Default, "|Referencia|", "Tudo Default ou qq diferente de 1,2,3,4: mais simples", "Teste do tipo Default", Default, Default, Default, Default, Default, Default, Default, Default, Default)
    InputCriar(250, Default, Default, Default, "|Canto inferior esquerdo|", "Tipo 1: 2 linhas", "Tipo 1: 2 linhas", 1, Default, Default, Default, Default, Default, Default, Default, Default)
    InputCriar(250, Default, Default, Default, "|Centralizado|", "Tipo 2: 2 linhas", "Tipo 2: 2 linhas", 2, Default, Default, Default, Default, Default, Default, Default, Default)
    InputCriar(250, Default, Default, Default, "|Alinhado a direita|", "Tipo 3: 2 linhas", "Tipo 3: 2 linhas", 3, Default, Default, Default, Default, Default, Default, Default, Default)
    InputCriar(250, Default, Default, Default, "|Baixo Relevo teste posição|", "Tipo 4: 2 linhas", "Tipo 4: ", 4, Default, Default, Default, Default, Default, Default, Default, Default)
    GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")
    GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
    GUISetState(@SW_SHOW, $Form[$Form[0][0]][0])
    While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $GUI_EVENT_CLOSE
                Exit
        EndSwitch
        Sleep(100)
    WEnd
EndFunc   ;==>Example
Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam)
    #forceref $hWnd, $iMsg
    Local $hWndFrom, $iIDFrom, $iCode, $IDIndex
    $hWndFrom = $lParam
    $iIDFrom = BitAND($wParam, 0xFFFF)
    $iCode = BitShift($wParam, 16)
    $IDIndex = _WinAPI_GetDlgCtrlID($hWndFrom)
    $a = UBound($ControlIndex)
    $a = $iIDFrom
    Local $sResumo = "CtrlHWnd:" & $hWndFrom & @CRLF & "CtrlID" & @TAB & ":" & $iIDFrom & "=$iIDFrom" & @TAB & "IDIndex:" & $IDIndex & @CRLF & "Code" & @TAB & ":" & $iCode & "BitShift($wParam, 16)[" & $iCode = BitShift($wParam, 16) & "] " & @CRLF & "GUICtrlRead(id, Default)[" & GUICtrlRead($iIDFrom) & "]GUICtrlRead(id, Advanced)[" & GUICtrlRead($iIDFrom, 1) & "]" & @CRLF
    If $iIDFrom > 9999 Then
        $sResumo &= "ID Alterado [" & $iIDFrom & "]=>"
        $iIDFrom = $baseID + $iIDFrom - 10000
        $sResumo &= "[" & $iIDFrom & "]+[" & $baseID & "]-10000" & @CRLF
    EndIf
    Local $Resposta
    If $iIDFrom > (UBound($ControlIndex) - 1) Then
    Else
        If $ControlIndex[$iIDFrom][1] <> "" Then
            Switch $ControlIndex[$iIDFrom][1]
                Case 1
                    $Resposta = CommandsLabel($iCode, $iIDFrom, $hWndFrom, $sResumo)
                    If $Resposta = 0 Then Return 0
                Case 2
                    $Resposta = CommandsInputBox($iCode, $iIDFrom, $hWndFrom, $sResumo)
                    If $Resposta = 0 Then Return 0
                Case Else
                    _DebugPrint("-----------------------------" & @CRLF & "WM_COMMAND >>>>>>Controle INDEFINIDO <<<<<<" & @CRLF & "-----------------------------" & @CRLF & $sResumo)
            EndSwitch
        EndIf
    EndIf
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_COMMAND
Func WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam)
    #forceref $hWnd, $iMsg, $wParam
    Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $tInfo
    $hWndFromCommmad = $lParam
    $iIDFromCommand = BitAND($wParam, 0xFFFF)
    $iCodeCommand = BitShift($wParam, 16)
    $tNMHDR = DllStructCreate($tagNMHDR, $lParam)
    $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
    $iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
    $iCode = DllStructGetData($tNMHDR, "Code")
    $IDIndex = _WinAPI_GetDlgCtrlID($hWndFrom)
    $a = UBound($ControlIndex)
    $a = $iIDFrom
    Local $sResumo = "hWnd:" & $hWnd & @TAB & "$iMsg:" & $iMsg & @CRLF & "$wParam:" & $wParam & " e $lParam" & $lParam & @CRLF & "CtrlHWnd:" & $hWndFrom & "=$hWndFromCommmad  =" & $lParam & @CRLF & "CtrlID" & @TAB & ":" & $iIDFrom & "=$iIDFrom = $iIDFromCommand= BitAND($wParam, 0xFFFF)=" & $iIDFromCommand & @TAB & "IDIndex:" & $IDIndex & @CRLF & "Code" & @TAB & ":" & $iCode & "$iCodeCommand = BitShift($wParam, 16) " & $iCodeCommand & @CRLF & "GUICtrlRead(id, Default)[" & GUICtrlRead($iIDFrom) & "]GUICtrlRead(id, Advanced)[" & GUICtrlRead($iIDFrom, 1) & "]" & @CRLF
    Local $Resposta
    If $iIDFrom > 9999 Then
        $sResumo &= "ID Alterado [" & $iIDFrom & "]=>"
        $iIDFrom = $baseID + $iIDFrom - 10000
        $sResumo &= "[" & $iIDFrom & "]+[" & $baseID & "]-10000" & @CRLF
    EndIf
    If $iIDFrom > UBound($ControlIndex) - 1 Then
    Else
        If $ControlIndex[$iIDFrom][1] <> "" Then
            Switch $ControlIndex[$iIDFrom][1]
                Case 1
                    _DebugPrint("-----------------------------" & @CRLF & "WM_NOTIFY - Infos:(labels)" & @CRLF & "-----------------------------" & @CRLF & $sResumo)
                Case 2
                    _DebugPrint("-----------------------------" & @CRLF & "WM_NOTIFY - Infos:(InputBox)" & @CRLF & "-----------------------------" & @CRLF & $sResumo)
                Case 3
                    _DebugPrint("-----------------------------" & @CRLF & "WM_NOTIFY - Infos:(EditBox)" & @CRLF & "-----------------------------" & @CRLF & $sResumo)
                Case 4
                    _DebugPrint("-----------------------------" & @CRLF & "WM_NOTIFY - Infos:(ComboBox)" & @CRLF & "-----------------------------" & @CRLF & $sResumo)
                Case 6
                    If $Resposta = 0 Then Return 0
            EndSwitch
        EndIf
    EndIf
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_NOTIFY

 

must be something related to events or style.

Link to comment
Share on other sites

  • Moderators
  • Solution

odaylton,

It is missing the "E:\0MeusDocs\0Projetos\AutoIt\0Biblio\02InputBoxVar.au3" include file - and I get an error telling me that $Inputs is undefined in the Acao02Input function.

And over 1000+ lines of code is not what I was expecting - can you not trim it down to just the inputs?

M23

Edit 1: With a bit of fiddling I have got the script running and I do see the same thing as you - investigating further.

Edit 2: I know what is happening - as I suspected you are applying the $ES_NOHIDESEL style to the inputs so that the selection remains visible whenever focus is lost. I am now trying to find out where you do this.

Edit 3: Found it - you are including a Static style in your Input style value which has the same value as $ES_NOHIDESEL:

If $InputEstilo = Default Then
        $InputEstilo = BitOR($ES_LEFT, $WS_TABSTOP, $SS_NOTIFY)

Remove that Static style and the inputs behave normally.

Edited by Melba23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

On 9/12/2021 at 4:19 AM, Melba23 said:

odaylton,

It is missing the "E:\0MeusDocs\0Projetos\AutoIt\0Biblio\02InputBoxVar.au3" include file - and I get an error telling me that $Inputs is undefined in the Acao02Input function.

And over 1000+ lines of code is not what I was expecting - can you not trim it down to just the inputs?

M23

Edit 1: With a bit of fiddling I have got the script running and I do see the same thing as you - investigating further.

Edit 2: I know what is happening - as I suspected you are applying the $ES_NOHIDESEL style to the inputs so that the selection remains visible whenever focus is lost. I am now trying to find out where you do this.

Edit 3: Found it - you are including a Static style in your Input style value which has the same value as $ES_NOHIDESEL:

If $InputEstilo = Default Then
        $InputEstilo = BitOR($ES_LEFT, $WS_TABSTOP, $SS_NOTIFY)

Remove that Static style and the inputs behave normally.

thank you so much for being willing to try and interpret such a long code, i tried to clean up as much as possible so i could find what i did wrong.
And you hit the bull's-eye.
The problem was that I used the same parameters used for the Label where there is the option $SS_NOTIFY (0x0100) which has the same value as $ES_NOHIDESEL

If $InputEstilo = Default Then
    $InputEstilo = BitOR($ES_LEFT, $WS_TABSTOP);, $SS_NOTIFY)
EndIf


I would like to post all these libraries so that the community can improve and help with development as I can only make improvements in my spare time.
If you can give some tips to create this post I would appreciate it very much.
How to create UDFs in a standardized way to generate quality content.

 

Link to comment
Share on other sites

  • Moderators

odaylton,

Glad I could help. But when you reply in future, please use the "Reply to this topic" button at the top of the thread or the "Reply to this topic" editor at the bottom rather than the "Quote" button - I know what I wrote and it just pads the thread unnecessarily. Thanks in advance for your cooperation.

As to the posting tips, I would suggest that the "AutoIt Projects and Collaboration" sub-forum within the "AutoIt Technical Discussion" forum would seem to be the ideal place to post your libraries.

But before doing so, i would suggest that you read the following Wiki pages to make sure that you are as standardized as you can be:

https://www.autoitscript.com/wiki/Best_coding_practices and https://www.autoitscript.com/wiki/UDF-spec

That way you will be sure that others can easily understand your code and offer suggestions. Oh, and please convert all comments to English - I can just about follow your Portuguese using my Spanish, but other may not be able to do so!

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

thanks for the guidelines.
I'll do my homework and read all the suggestions above and make a UDF for Autoit
The commentators are in Pt-Br only for this example due to the urgency of answering you but I will definitely try to make it as international as possible.

I used Quote with the intention of notifying you directly because I believed that when quoting a pout I know you would be warned, sorry for the inconvenience

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

×
×
  • Create New...