Sign in to follow this  
Followers 0
Kiti

Moving ArrayDisplay window

8 posts in this topic

Share this post


Link to post
Share on other sites



Kiti,

The _ArrayDisplay GUI is a blocking function like MsgBox, meaning your script is paused until it is closed. So you can never move it because by the time you try to move it, it no longer exists!

You will have to write your own GUI if you want to move it about, sorry. ;)

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

#4 ·  Posted (edited)

Hello!

I want to move the window resulted from arraydisplay function but it won't move by any means.

#include <array.au3>

global $array[10]

_arraydisplay($array,"ARRAYTITLE")


winmove("ARRAYTITLE","",100,100)

What can I do?

The window is displayed for the array and the function _arraydisplay does not return untill the window is closed, so of course you cannot move it like that.

An easy way to do it is like this, but there is a delay before it is moved.

#include <array.au3>
#include <timers.au3>

Global $array[10]
$timer1 = _Timer_SetTimer(0, 20, "shift")
_ArrayDisplay($array, "ARRAYTITLE")

Func shift($a,$b,$c,$d);parameters are unused but must be included
    If Not WinExists("ARRAYTITLE") Then Return

    WinMove("ARRAYTITLE", "", 100, 100)
    _Timer_KillTimer(0, $timer1)
EndFunc ;==>shift

Thank you in advance!

Edit: Would have been more sensible if I'd used AdlibRegister instead of using a timer but it still does the job. Edited by martin

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

martin,

Nice lateral thinking! ;)

Happy New Year! :evil:

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

I've integrated it into my script but I don't know why it's not resizing... :-/

#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>
#include<array.au3>
#include <timers.au3>




Opt("MustdeclareVars", 1)
Opt("GUIOnEventMode", 1)


Global $Form1, $Edit1, $Edit2, $Button1

Global $ET, $LS, $LR, $TE, $NS, $TM, $TM_0, $TM_1, $TM_2, $TM_3

Global $raport1, $striped1, $slot[2]

Global $v1[10], $v2[10], $v3[10], $v4[10], $array3[11][4]

Global $p, $x, $s, $i1, $i2, $i3, $timer1, $a, $b, $c, $d

$array3[0][0] = "Temp. max"
$array3[0][1] = "Reactor"
$array3[0][2] = "Energie/sat"
$array3[0][3] = "Ofiter"


$Form1 = GUICreate("Form1", 462, 200, 219, 126)
GUISetOnEvent($GUI_event_close, "Form1Close")
$Edit1 = GUICtrlCreateEdit("", 66, 37, 104, 121)
$Button1 = GUICtrlCreateButton("Button1", 198, 124, 75, 25, 0)
GUICtrlSetOnEvent($Button1, "Button1")

GUISetState(@SW_SHOW)




button1()


;~ While 1
;~  Sleep(100)
;~ WEnd




Func Form1Close()
    Exit 0
EndFunc ;==>Form1Close


Func Button1()
    
    $raport1 = GUICtrlRead($Edit1)
    $striped1 = StringStripWS($raport1, 8)


    $ET = StringRegExp($striped1, '(?:Energie:)([0-9.]{1,7})', 1)
    $LS = StringRegExp($striped1, '(?:UzinaSolara)([0-9]{1,2})', 1)
    $LR = StringRegExp($striped1, '(?:ReactordeFuziune)([0-9]{1,2})', 1)
    $TE = StringRegExp($striped1, '(?:TehnologiaEnergiei)([0-9]{1,2})', 1)
    $NS = StringRegExp($striped1, '(?:Satelitsolar)([0-9.]{1,6})', 1)
    $slot = StringRegExp($striped1, "((?:\[\d:\d{1,3}:)(\d{1,2})(?:\]))", 1)

    If Not IsArray($ET) Then
        $ET = 0
    Else
        $ET = Int(StringReplace($ET[0], ".", ""))
    EndIf


    If Not IsArray($LS) Then
        $LS = 0
    Else
        $LS = Int($LS[0])
    EndIf

    If Not IsArray($LR) Then
        $LR = 0
    Else
        $LR = Int($LR[0])
    EndIf


    If Not IsArray($TE) Then
        $TE = 0
    Else
        $TE = Int($TE[0])
    EndIf


    If Not IsArray($NS) Then
        $NS = 0
    Else
        $NS = Int(StringReplace($NS[0], ".", ""))
    EndIf
    
    If Not IsArray($slot) Then
        $slot = 0
    Else
        $slot = $slot[1]
    EndIf


    #cs
        $ET = 4567
        $LS = 20
        $LR = 0
        $TE = 12
        $NS = 23
        $p = 1
    #ce

;~  #cs
        $ET = 20030
        $LS = 23
        $LR = 0
        $TE = 0
        $NS = 442
        $p = 1
        $slot = 7
;~  #ce


    If $LR = 0 Then
        TM(0)
    Else
        TM(1)
    EndIf

    For $i = 1 To $i2 - 1
        $array3[$i][0] = $v1[$i]
        $array3[$i][1] = $v2[$i]
        $array3[$i][2] = $v3[$i]
        $array3[$i][3] = $v4[$i]
    Next
    
    _ArraySort($array3, 1, 1, $i2 - 1)


;--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    $timer1 = _Timer_SetTimer(0, 20, "shift")
    
    _ArrayDisplay($array3, "Slot " & $slot, $i2 - 1)
;--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------



    GUICtrlSetData($Edit1, "")

    ResetArrays()

EndFunc ;==>Button1


Func ResetArrays()
    $v1 = 0
    $v2 = 0
    $v3 = 0
    $v4 = 0
    $p = 1
    $i2 = 1
    $array3 = 0
    Global $v1[10], $v2[10], $v3[10], $v4[10], $array3[11][4]
    $array3[0][0] = "Temp. max"
    $array3[0][1] = "Reactor"
    $array3[0][2] = "Energie/sat"
    $array3[0][3] = "Ofiter"
EndFunc ;==>ResetArrays

Func TM($r)

    If $r = 0 Then
        $TM_0 = 4 * ((($ET - Int(20 * $LS * 1.1 ^ $LS)) / $NS) - 20)
        $TM_1 = 4 * Ceiling(((($ET - 20 * $LS * 1.1 ^ ($LS + 1)) / $NS) - 22) / 1.1)
        If IsInt($TM_0) Then
            $v1[$i2] = $TM_0
            $v2[$i2] = "-"
            $v3[$i2] = ($TM_0 / 4) + 20
            $v4[$i2] = "OFF"
            $i2 = $i2 + 1
        EndIf
        If IsInt($TM_1) Then
            $v1[$i2] = $TM_1
            $v2[$i2] = "-"
            $v3[$i2] = ($TM_1 / 4) + 20
            $v4[$i2] = "ON"
            $i2 = $i2
        EndIf
    EndIf

    If $r = 1 Then
        For $i1 = 0 To 10
            $TM_2 = ((4 * ($ET - Int(20 * $LS * 1.1 ^ $LS) - Int($p * 30 * $LR * (1.05 + $TE * 0.01) ^ $LR))) / $NS) - 80
            $TM_3 = 4 * ((Ceiling($ET / 1.1) - Int(20 * $LS * 1.1 ^ $LS) - Int($p * 30 * $LR * (1.05 + $TE * 0.01) ^ $LR))) / $NS - 80

            If IsInt($TM_2) And $TM_2 < 129 And $TM_2 > -128 Then
                If $i1 = 10 Then $p = 0
                $v1[$i2] = $TM_2
                $v2[$i2] = $p * 100 & "%"
                $v3[$i2] = Int($TM_2 / 4) + 20
                $v4[$i2] = "OFF"
                $i2 = $i2 + 1
            EndIf
            If Not StringInStr($TM_3, ".") And $TM_3 < 129 And $TM_3 > -128 Then
                $v1[$i2] = $TM_3
                $v2[$i2] = $p * 100 & "%"
                $v3[$i2] = Int($TM_3 / 4) + 20
                $v4[$i2] = "ON"
                $i2 = $i2 + 1
            EndIf
            $p = $p - 0.1
        Next
    EndIf

EndFunc ;==>TM


Func shift($a,$b,$c,$d);parameters are unused but must be included
    If Not WinExists("ARRAYTITLE") Then Return

    WinMove("Slot " & $slot, "", default,default,default,75 + 21 * $i2)
    _Timer_KillTimer(0, $timer1)
EndFunc ;==>shift

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

I've integrated it into my script but I don't know why it's not resizing... :-/

Func shift($a,$b,$c,$d);parameters are unused but must be included
    If Not WinExists("ARRAYTITLE") Then Return;<------------------------------------------because of this?

    WinMove("Slot " & $slot, "", default,default,default,75 + 21 * $i2)
    _Timer_KillTimer(0, $timer1)
EndFunc ;==>shift
Edited by martin

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0