Jump to content
Sign in to follow this  
weirddave

Gui buttons slow with mouse

Recommended Posts

weirddave

I have created a Gui with a number of GUICtrlCreateButton()

When I click on them with the mouse, the response by my script is very slow (1-2 secs), but if I navigate the buttons using the arrow keys and activate them with the Enter key, the response is fairly instant. Has anyone else seen this, and perhaps solved it?

Dave

Share this post


Link to post
Share on other sites
Melba23

weirddave,

Perhaps posting your script so we can test it might be good idea. ;)

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
weirddave

I can, but it's not going to be easy for anyone to run it as it is pulling in data over USB. it also relies on some ini files.

Global $GUIHandle = 0
Global $GUI2Handle = 0
Global $bb = 1
Global $repeats = 0
Global $Do
HotKeySet("{ESC}", "_ExitLoop")
Global $hDll_ntdll = DllOpen("ntdll.dll")
Dim $bitarray[8]=[1,2,4,8,16,32,64,128]
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
#include <StaticConstants.au3>
#include <ColorConstants.au3>
#include <ButtonConstants.au3>
#include <Math.au3>
#include <Timers.au3>
#include <FTD2XX.dll_UDF.au3>

$IniFile = @ScriptDir&"\FPGA_Comms.ini"
$Combined =  Number(IniRead ($IniFile,"Settings","Combined",1))
$IniArray = IniReadSection($IniFile, "Ini_List")
$NoInis = $IniArray[0][0]
$buttonHeight = 20
$width = 150
$height = $NoInis * $buttonHeight
$GUIHandle = GUICreate ( "FPGA Comms (Esc to quit)" , $width , $height ,-1,-1,BitOR($WS_MINIMIZEBOX , $WS_CAPTION))
Dim $IniButtonArray[$NoInis +1]
For $b = 1 to $NoInis
    $IniButtonArray[$b] = GUICtrlCreateButton($IniArray[$b][0],0,($b-1)*$buttonHeight,$width,$buttonHeight)
Next
GUISetState(@SW_SHOW, $GUIHandle)
$IniFile = ""
while $IniFile = ""
    $msg = GUIGetMsg()
    if $msg = $GUI_EVENT_CLOSE then _Terminate()
    For $b = 1 to $NoInis
        if $msg = $IniButtonArray[$b] then
            $IniFile = @ScriptDir&"\"&$IniArray[$b][1]
        endif
    next
    if $bb = $repeats then _Terminate()
    sleep(1)
wend
GUIDelete($GUIHandle)
Dim $ButtonArray = IniReadSection($IniFile, "Buttons")
if Not @error then
    $NoButs = $ButtonArray[0][0]
else
    $NoButs = 0
endif

$Ini_Name = @ScriptDir&"\"&IniRead ($IniFile,"Settings","DataIniFile","")
$repeats = Number(IniRead ($IniFile,"Settings","repeats",0))
$outstring = IniRead ($IniFile,"Settings","outstring","T")
$interval = Number(IniRead ($IniFile,"Settings","interval",1000))*1000
$datalength = Number(IniRead ($IniFile,"Settings","datalength",1))
$PartName = IniRead ($IniFile,"Settings","Part","")
$LabelsPerCol = Number(IniRead ($IniFile,"Settings","LabelsPerCol",40))
$stepping = 1
if $repeats = 0 then
    $repeats = 1
    $stepping = 0
endif
$IniSectionArray = IniReadSectionNames($Ini_Name)
$LabelHeight = 16
$ListWidth = 32
$ListHeight = $LabelHeight

if Mod($IniSectionArray[0],$LabelsPerCol)>0 then
    $t=1
Else
    $t=0
endif
$Columns = int($IniSectionArray[0]/$LabelsPerCol)+$t
$GUIHandle = GUICreate ( "" , 10 , 10)
Dim $LabelWidths[$Columns]
Dim $ColumnWidths[$Columns+1]
$ColumnWidths[0]=0

$width = 160
if $Combined <> 1 Then
    $width = 0
EndIf
if $NoButs = 0 then
    $width = 0
EndIf
For $b = 0 to $Columns-1
    $LabelWidths[$b]=0
    For $a=$LabelsPerCol*$b +1 to _Min($LabelsPerCol*($b+1),$IniSectionArray[0])
        $tt = GUICtrlCreateLabel ( $IniSectionArray[$a], 0, 0)
        $t = ControlGetPos ( $GUIHandle, "", $tt)
        GUICtrlDelete ($tt)
        If $t[2] > $LabelWidths[$b] Then
            $LabelWidths[$b] = $t[2]
        EndIF
    Next
    $ColumnWidths[$b+1] = $ListWidth + $LabelWidths[$b]
    $width = $width + $ColumnWidths[$b+1]
Next
$GUIHandle = GUIDelete($GUIHandle)
$height = _Min($IniSectionArray[0],$LabelsPerCol) * $LabelHeight
if $Combined = 1 Then
    $height = _Max($NoButs*40,_Min($IniSectionArray[0],$LabelsPerCol) * $LabelHeight)
endif
$GUIHandle = GUICreate ( "FPGA Data (Esc to quit)" , $width , $height ,-1,-1,BitOR($WS_MINIMIZEBOX , $WS_CAPTION))
Dim $Data_Array[$IniSectionArray[0]]
Dim $Label_Array[$IniSectionArray[0]]
For $a = 1 to $IniSectionArray[0]
    $Column = int(($a-1)/$LabelsPerCol)
    $X = 0
    for $b = 0 to $Column
        $X = $X + $ColumnWidths[$b]
    next
    $Row = $a - ($LabelsPerCol*$Column)-1
    $Label_Array[$a-1] = GUICtrlCreateLabel ( $IniSectionArray[$a], $X, $Row*$LabelHeight, $LabelWidths[$Column] , $LabelHeight ,BitOR($SS_SUNKEN,$SS_CENTER))
    $Data_Array[$a-1] = GUICtrlCreateLabel ( "", $X + $LabelWidths[$Column], $Row*$LabelHeight , $ListWidth, $ListHeight, BitOR($SS_SUNKEN,$SS_CENTER))
    GUICtrlSetColor($Data_Array[$a-1], $COLOR_RED)
    GUICtrlSetBkColor($Data_Array[$a-1], $COLOR_WHITE)
    $t=ControlGetPos ( $GUIHandle, "", $Label_Array[$a-1])
Next
GUISetState(@SW_SHOW, $GUIHandle)

if $NoButs > 0 then
    if $Combined <> 1 Then
        $GUI2Handle = GUICreate ( "Control" , 150 , $NoButs*40 ,-1,-1,$WS_MINIMIZEBOX + $WS_CAPTION + $WS_POPUP)
    EndIf
    $buttonX = $width-150
    If $Combined <> 1 Then
        $buttonX = 0
    EndIf
    Dim $GUIButtonArray[$NoButs +1]
    For $b = 1 to $NoButs
        $GUIButtonArray[$b] = GUICtrlCreateButton($ButtonArray[$b][0],$buttonX+0,($b-1)*40,150,40)
    next
    if $Combined <> 1 Then
        GUISetState(@SW_SHOW, $GUI2Handle)
    EndIf
endif
$Do = _FT_CreateDeviceInfoList($lpdwNumDevs)
If $Do <> 0 then
    msgbox(0,"","Something wrong!")
    _Terminate()
endif
$Do = _FT_GetDeviceInfoList($pDest, $lpdwNumDevs)
$NumDevices = DllStructGetData($lpdwNumDevs, 1)
If  $NumDevices < 1 then
    msgbox(0,"","No part attached")
    _Terminate()
Else
    $iDevice = -1
    for $pvArg1 = 0 to $NumDevices - 1
        $pvArg2 = DllStructCreate('char[100]')
        $Do = _FT_ListDevices($pvArg1, $pvArg2, BitOR($FT_LIST_BY_INDEX, $FT_OPEN_BY_SERIAL_NUMBER))
        $Part = DllStructGetData($pvArg2,1)
        if $Part = $PartName Then
            if $iDevice = -1 Then
                $iDevice = $pvArg1
                ;msgbox(0,$iDevice,$Part)
            Else
                msgbox(0,"","More than 1 Device found!")
                _Terminate()
            EndIf
        EndIf
    Next
    If $iDevice = -1 Then
        msgbox(0,"","Part "&$PartName&" Not Found")
        _Terminate()
    EndIf
EndIf
$Do = _FT_Open($iDevice, $fthandle)

If $Do <>0 then 
    msgbox(0,"","Failed to Open Port," & _USBFT_ErrorDescription($Do))
    _Terminate()
endif
$Do = _FT_SetBaudRate($FT_HANDLE, 250000)
$uWordLength = $FT_BITS_8
$uStopBits = $FT_STOP_BITS_1
$uParity = $FT_PARITY_NONE
$Do = _FT_SetDataCharacteristics($FT_HANDLE, $uWordLength, $uStopBits, $uParity)
$usFlowControl = $FT_FLOW_NONE
$uXon = 'A'
$uXoff = 'C'
$Do = _FT_SetFlowControl($FT_HANDLE, $usFlowControl, $uXon, $uXoff)
$framcounter = 0
    _FT_Purge($FT_HANDLE,  BitOR($FT_PURGE_RX, $FT_PURGE_TX))
$starttime = _Timer_Init()
for $bb = $stepping to $repeats step $stepping
    $t=""
    $msg = GUIGetMsg()
    if $msg = $GUI_EVENT_CLOSE then _ExitLoop()
    if $NoButs > 0 then
        For $b = 1 to $NoButs
            if $msg = $GUIButtonArray[$b] then
                $t = $ButtonArray[$b][1]
            endif
        next
    endif
    $t=$t&$outstring
    ;msgbox(0,"","["&$t&"]")
    _FT_Purge($FT_HANDLE,  BitOR($FT_PURGE_RX, $FT_PURGE_TX))
    DllStructSetData($lpBuffer, 1, $t)
    $dwBytesToWrite = StringLen($t)
    $Do = _FT_Write($FT_HANDLE, $lpBuffer, $dwBytesToWrite, $lpdwBytesWritten)

    $framcounter = $framcounter + 1
    $starttime2 = _Timer_Init()
    $Do = _FT_GetStatus($FT_HANDLE, $lpdwAmountInRxQueue, $lpdwAmountInTxQueue, $lpdwEventStatus)
    ;msgbox(0,"", DllStructGetData($lpdwAmountInTxQueue, 1))

    $dwBytesToRead = 0
    while $dwBytesToRead <$datalength
        $Do = _FT_GetStatus($FT_HANDLE, $lpdwAmountInRxQueue, $lpdwAmountInTxQueue, $lpdwEventStatus)
        $dwBytesToRead = DllStructGetData($lpdwAmountInRxQueue, 1)
        ;msgbox(0,"",$dwBytesToRead)
        if _Timer_Diff($starttime)>5000 then
            msgbox(0,"Rx issue","Rx Timeout")
            _ExitLoop()
            exitloop
        endif
        sleep(1)
    wend
    if DllStructGetData($lpdwAmountInRxQueue, 1) > $datalength then
        msgbox(0,"Rx Issue",DllStructGetData($lpdwAmountInRxQueue, 1)&" Bytes, expected: "&$datalength)
    endif
    if $bb < $repeats then  
        $dwBytesToRead = DllStructGetData($lpdwAmountInRxQueue, 1)
        DllStructSetData($lpBuffer, 1, '')
        $Do = _FT_Read($FT_HANDLE, $lpBuffer, $dwBytesToRead, $lpdwBytesReturned)
        if $Do <> 0 then msgbox(0,"","oh")
        ;msgbox(0,"",$dwBytesToRead)
        ;msgbox(0,"",DllStructGetData($lpdwBytesReturned,1))
        $data=DllStructGetData($lpBuffer, 1)
        ;msgbox(0,"",$data)
        for $a = 0 to $IniSectionArray[0]-1
            $Sect = $IniSectionArray[$a+1]
            $Bytes = IniRead ( $Ini_Name, $Sect, "Bytes",0)
            $SectData=""
            If $Bytes = 0 Then
                $ByteNum = IniRead ( $Ini_Name,$Sect,"Byte",-1)
                $Bits = IniRead ( $Ini_Name,$Sect,"Bits",-1)
                If $Bits = -1 Then
                    If BitAND ($bitarray[IniRead ( $Ini_Name,$Sect,"Bit",-1)] , Dec(StringMid($data,($ByteNum*2)+3,2))) >0 Then
                        $SectData = 1
                    Else
                        $SectData = 0
                    EndIf
                Else
                    For $b = $Bits to 1 step -1
                        If BitAND ($bitarray[IniRead ( $Ini_Name,$Sect,"Bit"&$b,-1)] , Dec(StringMid($data,($ByteNum*2)+3,2))) >0 Then
                            $SectData = $SectData + 2^($b-1)
                        EndIf
                    Next
                EndIf
            Else
                For $b = $Bytes to 1 step -1
                    $ByteNum = IniRead ( $Ini_Name,$Sect,"Byte"&$b,-1)
                    $SectData = $SectData & StringMid($data,($ByteNum*2)+3,2)
                Next
            EndIf
            GUICtrlSetData ($Data_Array[$a], $SectData)
        Next
        $t = int(_Timer_Diff($starttime)*1000)
        If $t < $interval Then
            _HighPrecisionSleep(($interval-$t))
        EndIf
        $starttime = _Timer_Init()
    Else
        ExitLoop
    endif
next
_Terminate()

Func _ExitLoop()
    $bb = $repeats
EndFunc
Func _Terminate()
    ;if $Do <> 0 then 
    _FT_Close($FT_HANDLE)
    If $GUIHandle > 1 Then
        GUIDelete($GUIHandle)
    EndIf
    If $GUI2Handle > 1 Then
        GUIDelete($GUI2Handle)
    EndIf
    DllClose($hDll_ntdll)
    Exit
EndFunc

Func _HighPrecisionSleep($iSleep)
    DllCall($hDll_ntdll, "dword", "NtDelayExecution", "int", 0, "int64*", -10 * $iSleep)
 EndFunc

here's FPGA_Comms.ini

[Settings]
Combined = 1

[Ini_List]
GLM_V1 = GLM_Lone_Test_settings.ini
73_Digital_OP_Test = 73_Digital_OP_Settings.ini
73_Digital = 73_Digital_Settings.ini

73_Digital_settings.ini

[Settings]
DataIniFile = 73_Digital_data.ini
LabelsPerCol = 46
repeats = 0
interval = 500
datalength = 128
outstring = T
Part = GLM_V1

[Buttons]
Reset Faults = R
MTU Control = M
MTU Up = N
MTU Down = P
O/P Test Mode Enable = o
Next = N
Previous = P
Toggle Output = t
Loadbank Mode = L
Ammeter Test = A
Speedo Test = S
Probe Sim = p
Probe 1 Speed Toggle = 1
Probe 2 Speed Toggle = 2
Probe 3 Speed Toggle = 3
Probe 4 Speed Toggle = 4

And here's 73_Digital_data.ini

[Speedo Test Active]
Byte = 30
Bit = 6
OK = 1
[Probe Sim Active]
Byte = 39
Bit = 7
OK = 1
[Probe 1 Speed]
Byte = 38
Bit = 4
[Probe 2 Speed]
Byte = 38
Bit = 5
[Probe 3 Speed]
Byte = 38
Bit = 6
[Probe 4 Speed]
Byte = 38
Bit = 7
[Ammeter Test Active]
Byte = 30
Bit = 7
OK = 1
[Loadbank Mode Active]
Byte = 39
Bit = 0
OK = 1
[MTU Mode Active]
Byte = 39
Bit = 1
OK = 1
[O/P Test Mode Active]
Byte = 19
Bit = 7
OK = 1
[Output Selected]
Bytes = 1
Byte1 = 27
;[FIELD I LIMITED]
;Byte = 14
;Bit = 6
;Flt = 1
;[AUX I LIMITED]
;Byte = 12
;Bit = 5
;Flt = 1
;[ARM1 I LIMITED]
;Byte = 12
;Bit = 7
;Flt = 1
;[ARM2 I LIMITED]
;Byte = 13
;Bit = 0
;Flt = 1
;[ARM3 I LIMITED]
;Byte = 13
;Bit = 1
;Flt = 1
;[ARM4 I LIMITED]
;Byte = 13
;Bit = 2
;Flt = 1
;[FIELD SERVO FAULT]
;Byte = 14
;Bit = 3
;Flt = 1
;[AUX SERVO FAULT]
;Byte = 14
;Bit = 4
;Flt = 1
;[ARM1 SERVO FAULT]
;Byte = 13
;Bit = 7
;Flt = 1
;[ARM2 SERVO FAULT]
;Byte = 14
;Bit = 0
;Flt = 1
;[ARM3 SERVO FAULT]
;Byte = 14
;Bit = 1
;Flt = 1
;[ARM4 SERVO FAULT]
;Byte = 14
;Bit = 2
;Flt = 1
;[Field ILOCK]
;Byte = 14
;Bit = 5
;Flt = 0
;[AUX ILOCK]
;Byte = 12
;Bit = 4
;Flt = 0
;[PROT ILOCK]
;Byte = 12
;Bit = 6
;Flt = 0
;[A1 ILOCK]
;Byte = 13
;Bit = 3
;Flt = 0
;[A2 ILOCK]
;Byte = 13
;Bit = 4
;Flt = 0
;[A3 ILOCK]
;Byte = 13
;Bit = 5
;Flt = 0
;[A4 ILOCK]
;Byte = 13
;Bit = 6
;Flt = 0
;[Probe 1 Supply OK]
;Byte = 18
;Bit = 4
;Flt = 0
;[Probe 2 Supply OK]
;Byte = 18
;Bit = 5
;Flt = 0
;[Probe 3 Supply OK]
;Byte = 18
;Bit = 6
;Flt = 0
;[Probe 4 Supply OK]
;Byte = 18
;Bit = 7
;Flt = 0
[Current Balance Relay]
Byte = 0
Bit = 7
Flt = 0
[Field Overload relay]
Byte = 1
Bit = 1
Flt = 0
[Arm1 Overload]
Byte = 2
Bit = 3
Flt = 0
[Arm 2 Overload]
Byte = 2
Bit = 4
Flt = 0
[Arm 3 Overload]
Byte = 2
Bit = 5
Flt = 0
[Arm 4 Overload]
Byte = 2
Bit = 6
Flt = 0

[TM1 Isolation Switch]
Byte = 1
Bit = 3
OK = 1
[O/P 04 Close TM1 Armature]
Byte = 20
Bit = 4
OK = 1
[Armature  Contactor 1 Proving]
Byte = 1
Bit = 7
OK = 1
[O/P 08 Motor 1 Isolate Indicator]
Byte = 21
Bit = 0
Flt = 1
[O/P 14 TM1 Field Isolator]
Byte = 22
Bit = 4
Flt = 0
[Field 4 Isolator Proving]
Byte = 2
Bit = 7
Flt = 0

[TM2 Isolation Switch]
Byte = 1
Bit = 4
OK = 1
[O/P 05 Close TM2 Armature]
Byte = 20
Bit = 5
OK = 1
[Armature  Contactor 2 Proving]
Byte = 2
Bit = 0
OK = 1
[O/P 09 Motor 2 Isolate Indicator]
Byte = 21
Bit = 1
Flt = 1
[O/P 15 TM2 Field Isolator]
Byte = 22
Bit = 5
Flt = 0
[Field 2 Isolator Proving]
Byte = 3
Bit = 0
Flt = 0

[TM3 Isolation Switch]
Byte = 1
Bit = 5
OK = 1
[O/P 06 Close TM3 Armature]
Byte = 20
Bit = 6
OK = 1
[Armature  Contactor 3 Proving]
Byte = 2
Bit = 1
OK = 1
[O/P 0A Motor 3 Isolate Indicator]
Byte = 21
Bit = 2
Flt = 1
[O/P 16 TM3 Field Isolator]
Byte = 22
Bit = 6
Flt = 0
[Field 3 Isolator Proving]
Byte = 3
Bit = 1
Flt = 0

[TM4 Isolation Switch]
Byte = 1
Bit = 6
OK = 1
[O/P 07 Close TM4 Armature]
Byte = 20
Bit = 7
OK = 1
[Armature  Contactor 4 Proving]
Byte = 2
Bit = 2
OK = 1
[O/P 0B Motor 4 Isolate Indicator]
Byte = 21
Bit = 3
Flt = 1
[O/P 17 TM4 Field Isolator]
Byte = 22
Bit = 7
Flt = 0
[Field 4 Isolator Proving]
Byte = 3
Bit = 2
Flt = 0

[O/P 38 Fan Stop]
Byte = 28
Bit = 0
[O/P 26 Derate]
Byte = 24
Bit = 6
[O/P 25 Power Earth Fault]
Byte = 24
Bit = 5
[O/P 23 Either Cab Active]
Byte = 24
Bit = 3
OK = 1
[O/P 22 Wheelslip Indicator]
Byte = 24
Bit = 2
Flt = 1
[O/P 20 General Fault]
Byte = 24
Bit = 0
Flt = 1
[O/P 21 ETS ON indicator]
Byte = 24
Bit = 1
OK = 1
[O/P 1F Automatic Sanding]
Byte = 23
Bit = 7
PK = 1
[O/P 1D Gx ON]
Byte = 23
Bit = 5
OK = 1
[Gx Contactor Proving]
Byte = 4
Bit = 2
OK = 1
[O/P 12 Engine Stop]
Byte = 22
Bit = 2
[O/P 0C SSF]
Byte = 21
Bit = 4
[NVR]
Byte = 0
Bit = 0
[O/P 37 Close HSCB]
Byte = 26
Bit = 7
OK = 1
[HSCB Proving]
Byte = 0
Bit = 1
OK = 1
[HSCB 0]
Byte = 19
Bit = 0
[HSCB 1]
Byte = 19
Bit = 1
[Shoe Valve Close]
Byte = 0
Bit = 2
[O/P 02 Close Line]
Byte = 20
Bit = 2
OK = 1
[Line Contactor Proving]
Byte = 0
Bit = 3
OK = 1
[O/P 10 Reverser FWD]
Byte = 22
Bit = 0
[Reverser FWD Proving]
Byte = 0
Bit = 4
[O/P 11 Reverser REV]
Byte = 22
Bit = 1
[Reverser REV Proving]
Byte = 0
Bit = 5
[O/P 01 Close Pre-Charge]
Byte = 20
Bit = 1
OK = 1
[Pre Charge Proving]
Byte = 0
Bit = 6
OK = 1
[O/P 03 Close TM Field]
Byte = 20
Bit = 3
OK = 1
[Field Contactor Proving]
Byte = 1
Bit = 0
OK = 1
[Fire Alarm Return]
Byte = 1
Bit = 2

;[Auxiliary Changeover 1 proving]
;Byte = 3
;Bit = 3
;[Auxiliary Changeover  2 proving]
;Byte = 3
;Bit = 4
;[Auxiliary Changeover  3 proving]
;Byte = 3
;Bit = 5
;[Auxiliary Changeover  4 proving]
;Byte = 3
;Bit = 6
;[Auxiliary Changeover  5 proving]
;Byte = 3
;Bit = 7
;[Auxiliary Changeover  6 proving]
;Byte = 4
;Bit = 0
;[Auxiliary Changeover  7 proving]
;Byte = 4
;Bit = 1

[Traction Motor Blower 1 CB Proving]
Byte = 4
Bit = 3
OK = 1
[Traction Motor Blower 2 CB Proving]
Byte = 4
Bit = 4
OK = 1
[Engine Room Fan CB Proving]
Byte = 4
Bit = 5
OK = 1
[Line Inductor Fan CB Proving]
Byte = 4
Bit = 6
OK = 1
[Compressor CB Proving]
Byte = 4
Bit = 7
[O/P 0E Close train Heat Contactor]
Byte = 21
Bit = 6
[Train Heat Contactor Proving]
Byte = 5
Bit = 0
[Train Heat Overload]
Byte = 5
Bit = 1
[Chopper Fan PSU Breaker Proving]
Byte = 5
Bit = 2
[Pressure Low]
Byte = 5
Bit = 3
[74V DVT Trainline PSU ON]
Byte = 5
Bit = 4
[Loadbank Pressure Switch Interlock]
Byte = 5
Bit = 5
[Reset Relay]
Byte = 5
Bit = 6
[MTU DC Link Voltage Reached]
Byte = 5
Bit = 7
[O/P 00 Electric/Diesel Changeover]
Byte = 20
Bit = 0
[Mode Changeover Proving N/O]
Byte = 6
Bit = 0
[Mode Changeover Proving N/C]
Byte = 6
Bit = 1
[Engine Running]
Byte = 6
Bit = 2
[Alarm- MTU Eng Cold]
Byte = 6
Bit = 3
[PEFR Power Detected]
Byte = 6
Bit = 4
[PEFR –Ve Earth Fault]
Byte = 6
Bit = 5
[Alarm - MTU Derate]
Byte = 6
Bit = 6
[Control Earth Fault]
Byte = 6
Bit = 7
[PEFR +Ve Earth Fault]
Byte = 7
Bit = 0
[Earth Fault Iso Switch (Diesel Only)]
Byte = 7
Bit = 1
[Master Switch Forward]
Byte = 7
Bit = 2
OK = 1
[Master Switch Reverse]
Byte = 7
Bit = 3
OK = 1
[Cab 1 Active]
Byte = 7
Bit = 4
OK = 1
[Cab 2 Active]
Byte = 7
Bit = 5
OK = 1
[Diesel Mode]
Byte = 7
Bit = 6
[Electric Mode / Engine Stop]
Byte = 7
Bit = 7
[Engine Start]
Byte = 8
Bit = 0
[Reset]
Byte = 8
Bit = 1
[Up/Mast Run Back]
Byte = 8
Bit = 2
OK = 1
[Up/Mast Hold]
Byte = 8
Bit = 3
OK = 1
[Up/Mast Series]
Byte = 8
Bit = 4
OK = 1
[Up/Mast Parallel]
Byte = 8
Bit = 5
OK = 1
[Up/Mast Notch Up / Weak Field]
Byte = 8
Bit = 6
OK = 1
[Up/Mast OFF – Cab 2]
Byte = 8
Bit = 7
OK = 1
[Up/Mast OFF – Cab 1]
Byte = 9
Bit = 0
OK = 1
[Low/Mast AAR Input A]
Byte = 9
Bit = 1
OK = 1
[Low/Mast AAR Input B]
Byte = 9
Bit = 2
OK = 1
[Low/Mast AAR Input C]
Byte = 9
Bit = 3
OK = 1
[Low/Mast AAR Input D]
Byte = 9
Bit = 4
OK = 1
[Low/Mast Power On]
Byte = 9
Bit = 5
OK = 1
[Low/Mast Active]
Byte = 9
Bit = 6
OK = 1
[Low/Mast Engine Start Enable]
Byte = 9
Bit = 7
OK = 1
[ETS CMD]
Byte = 10
Bit = 0
[Low/Mast Diesel On]
Byte = 10
Bit = 1
OK = 1
[Up/Mast Diesel On]
Byte = 10
Bit = 2
OK = 1
[Smart Relay Status]
Byte = 10
Bit = 3
[Webasto Status]
Byte = 10
Bit = 4
[Electric Pre-Heat Status]
Byte = 10
Bit = 5
[Battery Charger Input Contactor proving]
Byte = 10
Bit = 6
[Compressor Over Temp]
Byte = 10
Bit = 7
[O/P 28 Inverter 1 Contactor]
Byte = 25
Bit = 0
[Inverter 1 OK]
Byte = 11
Bit = 0
[O/P 29 Inverter 2 Contactor]
Byte = 25
Bit = 1
[Inverter 2 OK]
Byte = 11
Bit = 1
[O/P 2A Inverter 3 Contactor]
Byte = 25
Bit = 2
[Inverter 3 OK]
Byte = 11
Bit = 2
[O/P 2B Inverter 4 Contactor]
Byte = 25
Bit = 3
[Inverter 4 OK]
Byte = 11
Bit = 3
[O/P 2C Battery Charger Contactor]
Byte = 25
Bit = 4
[Battery Charger OK]
Byte = 11
Bit = 4
[Low Fuel Warning]
Byte = 11
Bit = 5
[74V DVT PSU Ok]
Byte = 11
Bit = 6
[LINE OVLD]
Byte = 11
Bit = 7
[PEF (ELECTRIC)]
Byte = 12
Bit = 0
[ENGINE O/LD]
Byte = 12
Bit = 1
[ENGINE U/LD]
Byte = 12
Bit = 2
[LOAD CTRL ACTIVE]
Byte = 12
Bit = 3
Flt = 1

[FCT2_LO]
Byte = 14
Bit = 7
[FCT3_LO]
Byte = 15
Bit = 0
[FCT4_LO]
Byte = 15
Bit = 1
[FCT5_LO]
Byte = 15
Bit = 2
[FCT6_LO]
Byte = 15
Bit = 3
[MICRO WD]
Byte = 15
Bit = 4
[Zero Current]
Byte = 15
Bit = 5
;[ARM1 FAN1]
;Byte = 15
;Bit = 6
;[ARM1 FAN2]
;Byte = 15
;Bit = 7
;[ARM2 FAN1]
;Byte = 16
;Bit = 0
;[ARM2 FAN2]
;Byte = 16
;Bit = 1
;[ARM3 FAN1]
;Byte = 16
;Bit = 2
;[ARM3 FAN2]
;Byte = 16
;Bit = 3
;[ARM4 FAN1]
;Byte = 16
;Bit = 4
;[ARM4 FAN2]
;Byte = 16
;Bit = 5
;[FIELD FAN1]
;Byte = 16
;Bit = 6
;[FIELD FAN2]
;Byte = 16
;Bit = 7
;[PROT FAN1]
;Byte = 17
;Bit = 0
;[PROT FAN2]
;Byte = 17
;Bit = 1
;[AUX FAN1]
;Byte = 17
;Bit = 2
;[AUX FAN2]
;Byte = 17
;Bit = 3
;[TEST DI1]
;Byte = 17
;Bit = 4
;[TEST DI2]
;Byte = 17
;Bit = 5
;[TEST DI3]
;Byte = 17
;Bit = 6
;[TEST DI4]
;Byte = 17
;Bit = 7
;[TEST DI5]
;Byte = 18
;Bit = 0
;[TEST DI6]
;Byte = 18
;Bit = 1
 

That will be enough to make the last button work on the first window. Bypassing the USB comms will be interesting!

(and yes, I know it's a mess, It's grown a bit randomly as new features were added)

Share this post


Link to post
Share on other sites
Melba23

weirddave,

That is of no help at all. You provide a reproducer script that shows the delay and I will happily help you debug it, but just posting a mess of code which does not even have all the UDFs needed (what is FTD2XX.dll_UDF.au3?) and which you admit will not be easy to run is not going to tempt me, nor I suspect anyone else, to spend time looking at it in detail. ;)

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
weirddave

OK, I will attempt to come up with something a bit more useful, it'll probably be a couple of days before I get the time to play again...

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  

  • Similar Content

    • Yirrlaar
      By Yirrlaar
      #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <TabConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("MyCommands", 406, 236, 610, 129) $Main = GUICtrlCreateTab(8, 8, 385, 217) $TabSheet1 = GUICtrlCreateTabItem("Main") $StopFunc = GUICtrlCreateButton("STOP", 17, 43, 150, 50) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") $StartFunc = GUICtrlCreateButton("Start", 17, 98, 150, 50) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") $Input0 = GUICtrlCreateInput("Input0", 267, 43, 75, 24, BitOR($GUI_SS_DEFAULT_INPUT,$ES_CENTER)) $Input1 = GUICtrlCreateInput("Input1"", 267, 73, 75, 24, BitOR($GUI_SS_DEFAULT_INPUT,$ES_CENTER)) $Input2 = GUICtrlCreateInput("Input2", 267, 103, 75, 24, BitOR($GUI_SS_DEFAULT_INPUT,$ES_CENTER)) $Input3 = GUICtrlCreateInput("Input3", 267, 133, 75, 24, BitOR($GUI_SS_DEFAULT_INPUT,$ES_CENTER)) $Input4 = GUICtrlCreateInput("Input4", 267, 163, 75, 24, BitOR($GUI_SS_DEFAULT_INPUT,$ES_CENTER)) $Input5 = GUICtrlCreateInput("Input5", 267, 195, 75, 24, BitOR($GUI_SS_DEFAULT_INPUT,$ES_CENTER)) $Label1 = GUICtrlCreateLabel("Label1", 215, 43, 50, 20, $SS_RIGHT) GUICtrlSetFont(-1, 9, 800, 0, "MS Sans Serif") $Label2 = GUICtrlCreateLabel("Label2", 215, 73, 50, 20, $SS_RIGHT) GUICtrlSetFont(-1, 9, 800, 0, "MS Sans Serif") $Label3 = GUICtrlCreateLabel("Label3", 215, 103, 50, 20, $SS_RIGHT) GUICtrlSetFont(-1, 9, 800, 0, "MS Sans Serif") $Label4 = GUICtrlCreateLabel("Label4", 215, 133, 50, 20, $SS_RIGHT) GUICtrlSetFont(-1, 9, 800, 0, "MS Sans Serif") $Label5 = GUICtrlCreateLabel("Label5", 215, 163, 50, 20, $SS_RIGHT) GUICtrlSetFont(-1, 9, 800, 0, "MS Sans Serif") $Label6 = GUICtrlCreateLabel("Label6", 191, 195, 74, 20, $SS_RIGHT) GUICtrlSetFont(-1, 9, 800, 0, "MS Sans Serif") $TabSheet2 = GUICtrlCreateTabItem("Individuals") $Button1 = GUICtrlCreateButton("Button1", 17, 43, 75, 25) GUICtrlCreateTabItem("") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit case $StartBOT letsdothis() Case $StopBOT END_This() EndSwitch WEnd func letsdothis() While 1 ;doing stuff ;doing more stuff if $StopFunc Then END_This() ;how do i detect if the button has been pressed if $Button1 Then Sleepy_Time() ;doing things ;doing more things WEnd EndFunc Func Sleepy_Time() while 1 sleep(10) if $Button1 Then ExitLoop ; detect button press and return to previous state Wend EndFunc Func END_This() Exit EndFunc For the LIFE of me I can't figure out, HOW ON EARTH to detect that a button has been pressed while a function is running?
      Can someone PLEASE point me in the right direction???
      Thanks
    • John C.
      By John C.
      ;Adding $BS_DEFPUSHBUTTON doesn't work
              $idCopy_Data = GUICtrlCreateButton("Copy Data Only", $iButtonWidth_2, $aiGUISize[1] - $iButtonMargin, $iButtonWidth_2, 20, $BS_DEFPUSHBUTTON)
      ;Adding these two lines doesn't work either
               Local $aAccelKeys[2][2] = [["{enter}", $idCopy_Data], ["^{enter}", $idCopy_ID]]
              GUISetAccelerators($aAccelKeys)
       
    • Fenzik
      By Fenzik
      Hello,
      my question is based on topic about Nvda Screen reader development atThis Link
      Autoit GUI is totaly nice for blind users, because it's controls are mostly standart.
      But in cooperation with Screen Readers this guis are much slower than other guis.
      Do you have any idea about reason of this behaviour?
      Thanks a lot for any answer.
      Fenzik
    • 232showtime
      By 232showtime
      Hi need some help with the space between two buttons, if I ran the script the space between two buttons is gone and when I maximized the gui, space between two button is showing,
      #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $hGUI1 = GUICreate("Test", 1090, 800, 200, 200, BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_SIZEBOX, $WS_THICKFRAME, $WS_TABSTOP, $WS_HSCROLL, $WS_VSCROLL)) $TopRight1 = GUICtrlCreateButton("Test1", 800, 25, 70, 50) $TopRight2 = GUICtrlCreateButton("Test2", 850, 25, 70, 50) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd this is the first time I encounter this problem.
    • JuanFelipe
      By JuanFelipe
      Hi friends, I need help with the process, I have a button to initiate a code but do not know how to configure it to be the button to start the process, thank you very much for your help.
      Here I leave the code to see if I have to change some part.
      #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <ProgressConstants.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form=c:\users\juan.caballeron\desktop\ \programacion\autoit\capturas\koda_1.7.3.0\forms\grabar capturas.kxf $Form1_1 = GUICreate("WhiteSnake", 655, 487, 192, 124) GUISetIcon("C:\Users\juan.caballeron\Desktop\ \Programacion\Autoit\Capturas\koda_1.7.3.0\iconos\Avatar on ice-256.ico", -1) GUISetBkColor(0xC8C8C8) $hechos = GUICtrlCreateGroup("Hechos", 16, 32, 385, 169) GUICtrlSetColor(-1, 0x000000) $box_fechah = GUICtrlCreateInput("", 112, 72, 81, 21) GUICtrlSetLimit(-1, 10) $box_hora = GUICtrlCreateInput("", 112, 104, 81, 21) GUICtrlSetLimit(-1, 5) $box_fechaf = GUICtrlCreateInput("", 112, 136, 81, 21) GUICtrlSetLimit(-1, 10) $box_fte = GUICtrlCreateInput("", 112, 168, 81, 21) GUICtrlSetLimit(-1, 5) $Label3 = GUICtrlCreateLabel("Fecha Hecho:", 24, 72, 72, 17) $Label4 = GUICtrlCreateLabel("Hora:", 24, 104, 30, 17) $Label5 = GUICtrlCreateLabel("Fecha Fuente:", 24, 136, 73, 17) $Label6 = GUICtrlCreateLabel("Nro. Fuente:", 24, 168, 63, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) $personas = GUICtrlCreateGroup("Datos de la Persona", 16, 224, 585, 185) $Label1 = GUICtrlCreateLabel("Tipo Identificación:", 32, 256, 94, 17) $Label2 = GUICtrlCreateLabel("No. Documento:", 32, 280, 82, 17) $Label7 = GUICtrlCreateLabel("Apellidos", 32, 304, 46, 17) $Label8 = GUICtrlCreateLabel("Nombres", 32, 328, 46, 17) $Label9 = GUICtrlCreateLabel("Sexo", 32, 352, 28, 17) $Label10 = GUICtrlCreateLabel("Fecha Nacimiento", 32, 376, 90, 17) $Combo1 = GUICtrlCreateCombo("Selección", 128, 256, 193, 21) $Combo1 = GUICtrlSetData(-1, "Tarjeta de Identidad|Cédula") GUICtrlSetLimit(-1, 1) $documento = GUICtrlCreateInput("", 128, 280, 193, 21) $apellidos = GUICtrlCreateInput("", 128, 304, 377, 21) $nombres = GUICtrlCreateInput("", 128, 328, 377, 21) $Combo2 = GUICtrlCreateCombo("Selección", 128, 352, 121, 21) $Combo2 = GUICtrlSetData(-1, "Masculino|Femenino") GUICtrlSetLimit(-1, 1) $fecha_naci = GUICtrlCreateInput("", 128, 376, 121, 21) GUICtrlSetLimit(-1, 10) GUICtrlCreateGroup("", -99, -99, 1, 1) $datoscap = GUICtrlCreateGroup("Datos Capturas", 456, 32, 145, 169) $Label11 = GUICtrlCreateLabel("Label11", 472, 56, 42, 17) $Label12 = GUICtrlCreateLabel("Label12", 472, 80, 42, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) $Titulo = GUICtrlCreateLabel("PROCESO PARA GRABAR CAPTURAS EN EL SIEDCO.", 175, 8, 277, 17, $SS_CENTER) GUICtrlSetCursor (-1, 3) $Progress1 = GUICtrlCreateProgress(448, 432, 169, 9) GUICtrlSetCursor (-1, 15) $creador = GUICtrlCreateLabel("By WhiteSnake", 8, 440, 78, 17) GUICtrlSetColor(-1, 0xFF0000) $Icon1 = GUICtrlCreateIcon("C:\Users\juan.caballeron\Desktop\ \Programacion\Autoit\Capturas\koda_1.7.3.0\iconos\1249549841170809086.ico", -1, 88, 432, 32, 32) $iniciar = GUICtrlCreateButton("INICIAR PROCESO", 296, 424, 145, 25) GUICtrlSetCursor (-1, 0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd  
      I just need to know how to do that when you click the $iniciar start any process.
×