Jump to content

Label Problem


Digisoul
 Share

Recommended Posts

Hi guys,

I am facing a little problem about Lable control, I m useing the While loop to send string to LAbel Control but when the loop starts the tranparent background disappears for a bit time, how can i stop it to flick?

i m using this code:

$crnt_file = GUICtrlCreateLabel("", 48, 104, 489, 33,$SS_LEFTNOWORDWRAP)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)

73 108 111 118 101 65 117 116 111 105 116

Link to comment
Share on other sites

can you make a small example script to duplicate the problem?

8)

Thanks for giving me a chance sir,

here is the example task that i tried ; by the above code,

$s_window= GUICreate("Search window", 550, 400, -1, -1, -1, BitOR($WS_EX_APPWINDOW, $WS_EX_WINDOWEDGE))
GUISetOnEvent($GUI_EVENT_CLOSE, "on_exit")

$crnt_file = GUICtrlCreateLabel("", 48, 104, 489, 33,$SS_LEFTNOWORDWRAP)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT

$start = GUICtrlCreateButton("start", 425, 370, 54, 25)
GUISetOnEvent($start, "start_sch")

while 1
sleep(1000)
wend

Func start_sch()
Search("D:\","*.*")
EndFunc

Func Search($current,$toFind)
    If $g <> 1 Then
    If StringRight($current,1) = "\" then $current = StringTrimRight($current,1)
    Local $search = FileFindFirstFile($current & "\*.*")
    While 1
        
        
        Dim $file = FileFindNextFile($search)
        If @error Or StringLen($file) < 1 Then ExitLoop
        If Not StringInStr(FileGetAttrib($current & "\" & $file), "D") And ($file <> "." Or $file <> "..") Then
            
        GUICtrlSetData($crnt_file,$current& "\" &$file)
        Sleep(10)

        ConsoleWrite(@CRLF&"+>"&$i&"File Name "&$current& "\" &$file)
            IF $file = $toFind then Msgbox(0,"File found", $current & "\" & $file)
                
        EndIf
        If StringInStr(FileGetAttrib($current & "\" & $file), "D") And ($file <> "." Or $file <> "..") Then
            Search($current & "\" & $file, $toFind)
            
        EndIf
        
    WEnd
    FileClose($search)
EndIf
EndFunc

i also tried sleep but its still not working for me !

Edited by Digisoul

73 108 111 118 101 65 117 116 111 105 116

Link to comment
Share on other sites

Thats not a working code... I tried to fix it, but, I need a working code to help with what you asked for....

My best guest to the original question is that the label is changing names so fast that it appears as a "flicker" maybe put them in a listview() or something that can handle more files/input.

Lastly, I did a lot of work on a similar project, no nee to re-invent the wheel

#141335

8)

Edited by Valuater

NEWHeader1.png

Link to comment
Share on other sites

Thats not a working code... I tried to fix it, but, I need a working code to help with what you asked for....

My best guest to the original question is that the label is changing names so fast that it appears as a "flicker" maybe put them in a listview() or something that can handle more files/input.

Lastly, I did a lot of work on a similar project, no nee to re-invent the wheel

#141335

8)

Thank you sir your suggentions are really helpful. in case i sent my code, may b any magic will happens.

actually i use List view for some log. so thats y i dont want to store the files in any control, i just want to show them, in control.

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListBoxConstants.au3>
#include <GuiImageList.au3>
#include <GuiListView.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Array.au3>
;-----------Scan windows Global vars
Global $can_scan = 0
Global $targets[1] = ["D:"]
; ===========================Scaning Window===============================================
$user_scan = GUICreate("User Scan", 550, 400, -1, -1, -1, BitOR($WS_EX_APPWINDOW, $WS_EX_WINDOWEDGE))

$bck = GUICtrlCreatePic(@WindowsDir&"\Web\Wallpaper\Peace.jpg", 0, 0, 550, 400,$WS_CLIPSIBLINGS )
 GUICtrlSetState(-1, $GUI_DISABLE)
 GuiCtrlSetState(-1,$GUI_ONTOP)
$start_btn = GUICtrlCreateButton("Start", 362, 370, 54, 25)


$pause = GUICtrlCreateButton("Pause", 425, 370, 54, 25)


$crnt_file = GUICtrlCreateLabel("", 48, 104, 489, 100,$GUI_DOCKAUTO)
 GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)

GUISetState(@SW_SHOW, $user_scan)


While 1
    $msg = GUIGetMsg()
Switch $msg
    Case $GUI_EVENT_CLOSE
        Exit
    Case $start_btn
        start_scan()
    EndSwitch
WEnd

Func on_exit()
    If @GUI_WinHandle = $user_scan Then
        Exit
    EndIf
EndFunc  ;==>on_exit

Func start_scan()
    ConsoleWrite("start_scan")

    For $t = 0 To UBound($targets) - 1
        If $can_scan <> 1 Then
            ConsoleWrite(">Target found: " & $targets[$t] & @CRLF)
            $atrb = FileGetAttrib($targets[$t])
        
            If StringInStr($atrb, "D") Then
                Search($targets[$t], "*.*")
            Else
                GUICtrlSetData($crnt_file, $targets[$t])
                
            EndIf

        EndIf

    Next

EndFunc  ;==>start_scan

Func Search($current, $toFind)
    
    If StringRight($current, 1) = "\" Then $current = StringTrimRight($current, 1)
    Local $search = FileFindFirstFile($current & "\*.*")
    While 1
        If $can_scan = 1 Then ExitLoop
        
        Dim $file = FileFindNextFile($search)
        If @error Or StringLen($file) < 1 Then ExitLoop
        If Not StringInStr(FileGetAttrib($current & "\" & $file), "D") And ($file <> "." Or $file <> "..") Then
            
            GUICtrlSetData($crnt_file, $current & "\" & $file)
            
            Sleep(10)
            ConsoleWrite(@CRLF & "+>" & "File Name " & $current & "\" & $file)
            If $file = $toFind Then MsgBox(0, "File found", $current & "\" & $file)

        EndIf
        If StringInStr(FileGetAttrib($current & "\" & $file), "D") And ($file <> "." Or $file <> "..") Then
            Search($current & "\" & $file, $toFind)

        EndIf
        Status()
    WEnd
    FileClose($search)

EndFunc  ;==>Search

Func Status()
    Local $in_loop = GUIGetMsg()

    Switch $in_loop
        Case $GUI_EVENT_CLOSE
            Exit
        Case $pause
            $can_scan = 1
        GUICtrlSetData($pause,"EXIT")
            
    EndSwitch
EndFunc  ;==>Status

this code is in progress but it can present the orignal problem.

73 108 111 118 101 65 117 116 111 105 116

Link to comment
Share on other sites

Look, it's really hard for me to go through your defective code ( no insult intended )

When I have already made the same thing... take what you like from it, but it has all the answers

http://www.autoitscript.com/forum/index.ph...st&p=141335

8)

Ah, i dont know wats wrong with the code in your side. Anyways i got the answer(Actually alternate).

Thank you very much Sir , for your kind help & time.

73 108 111 118 101 65 117 116 111 105 116

Link to comment
Share on other sites

  • 3 weeks later...

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...