Jump to content
CT83

All GUI Labels Display Weird Text (222)

Recommended Posts

CT83
 

I my gui labels, tab names, and everything has suddenly started displaying the digits "222" for some reason. I personally have not set them to display this, I searched for the string "222" in my code to see if i was accidentally over-writing them by code bt, i dont seem to find anything. This is a mysterious problem! Has anyone encountered anything like this?

PS Attaching a screenshot of what my gui currently looks like. The error occurs after some time of running the code, I am not quite sure which line is causing the error. so i cant really produce a reproducer

 

2016-12-11-PHOTO-00002610.jpg

Edited by CT83
added code

Share this post


Link to post
Share on other sites
Melba23

CT83,

It is obviously the additional variable you have put in line #87.

...

Seriously, if you want help with this problem, post the code that you use to create the GUI so we can take a look.

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
CT83
5 minutes ago, Melba23 said:

CT83,

It is obviously the additional variable you have put in line #87.

...

Seriously, if you want help with this problem, post the code that you use to create the GUI so we can take a look.

M23

Done, Melba23

Share this post


Link to post
Share on other sites
Melba23

CT83,

And when you run that code as posted (with a loop to keep it visible) it gives you "222" in every label? It certainly does not when I do.

The only thing I can think of is that you have a loop somewhere else in your script which is setting every control to that value. Is there such a loop somewhere later in the script which might do this?

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
CT83
Just now, Melba23 said:

CT83,

And when you run that code as posted (with a loop to keep it visible) it gives you "222" in every label? It certainly does not when I do.

The only thing I can think of is that you have a loop somewhere else in your script which is setting every control to that value. Is there such a loop somewhere later in the script which might do this?

M23

No, that's the surprising part, When I run it it gives me no errors or 222 either! I have no loop to set the data of every label to 222, but! when i compile it and leave it running and doing for few hours on other machines it automatically sets the 222 values.

PS on searching for the value "222" in my code the only thing it returned was "color_Var2=0x222222" this was the only instance of the characters 222 in my code no thing else any where! 

Btw is there a way to actually do that? I mean set values of every  label to a certain value? and what should i be looking for which might cause this kind of problem?

I am going to run few tests again and report here!

Share this post


Link to post
Share on other sites
Melba23

CT83,

I suggest posting the entire script - something in there must be changing the label content.

If it is a loop it would have to be along these lines:

For $i = Some_Smallish_Number To Some_Much_Bigger_Number
    GUICtrlSetData($i, Some_variable_set_to_222)
Next

Then every control that reacts to that command would change. But I would have thought that such a thing would be pretty obvious - hence my puzzlement.

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
CT83
6 hours ago, Melba23 said:

CT83,

I suggest posting the entire script - something in there must be changing the label content.

If it is a loop it would have to be along these lines:

For $i = Some_Smallish_Number To Some_Much_Bigger_Number
    GUICtrlSetData($i, Some_variable_set_to_222)
Next

Then every control that reacts to that command would change. But I would have thought that such a thing would be pretty obvious - hence my puzzlement.

M23

Yes! you were right! it was this bit of code 

$Successful=$Successful+1
GUICtrlSetData($Successful,$guielement)

Reversed the, $guielement var and $Successful var. :( and as it turns out the label number of $guielement was number 222, so it was setting it to 222. 

I apologize for the carelessness from my side. :( My bad...:>

Thanks M23, u are awesome! :) 

Share this post


Link to post
Share on other sites
Melba23

CT83,

Glad you found the misbehaving line and that I could help.

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

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

  • Similar Content

    • kcvinu
      By kcvinu
      Hi all,
      I have a button created with _GUICtrlButton_Create function. I know that this function returns a handle of button instead of an ID. So i have obtain control ID by calling _WinAPI_GetDlgCtrlID function. After that i have tried the GUICtrlSetBkColor function. But it didnt worked. Any suggestions will be appreciated. Thanks in advance. 
      Note : - The window which carries this button is not created with native gui create function. Instead, it is created with CreateWindowEx api function.
    • kcvinu
      By kcvinu
      Hi all,
      I am playing with _GUICtrlButton_Create function. How can i change this button's (or the entire form's) font ?. The in-built GUICtrlSetFont function is not working even when i convert the control handle to control ID with _WinAPI_GetDlgCtrlID ( ) function.  Do i need to use CreateFont api finction and send WM_SETFONT message ? Or is there any other easy and safe ways to do this ?. Thanks in advance.
      Note : This window is created by CreateWindowEx function, not by GUICreate function. 
    • Jake_s
      By Jake_s
      Hi All, 
       
      I am a begginer in auto it. I am trying to build simple gui that will show me if for example notepad.exe process is currently running on the system. I have built something like this, but when I execute it shows me message boxes, but I want the results to show in gui. If you can help me start with this.
       
      Thanks
       
        #include <MsgBoxConstants.au3>
      #include <GUIConstantsEx.au3>

      ActiveProcess()

      Func ActiveProcess()
      GUICreate("Act")
               ProcessExists("wuauclt.exe")

             If ProcessExists("wuauclt.exe") Then
       MsgBox($MB_SYSTEMMODAL, "", "Windows Upates are running")
           Else
       MsgBox($MB_SYSTEMMODAL, "", "Windows Updates are not running")
       EndIf
         ;Notepad

               ProcessExists("notepad.exe")

               If ProcessExists("notepad.exe") Then
      MsgBox($MB_SYSTEMMODAL, "", "Notepad is running")
              Else
      MsgBox($MB_SYSTEMMODAL, "", "Notepad is not running")
      EndIf  
       
    • corz
      By corz
      This is a magnifier-color-picker thing mostly based on some code I found on Stack Overflow, of all places. At least all the clever bits are from there. 
      I'd love to use this code inside an app I'm working on. But it has an issue. The first time the mag pops up it works perfectly, but the second and subsequent times, it's a boring grey square. 
      One of you smart dudes will probably look at this and go, "Aha!", but I'm stumped.
      #include <WindowsConstants.au3> #include <WinAPI.au3> #include <StaticConstants.au3> MagWindow() MagWindow() ; Magnifier-Color-Picker.. ; Props to McBarby for the cross-hairs. func MagWindow() global $iMagZoom = 5 global $iMagWidth = Ceiling(100/$iMagZoom) global $iMagHeight = Ceiling(100/$iMagZoom) global $hDCDesk, $hDCZoom, $hPen global $hUser32 = DllOpen("user32.dll") global $hGDI32 = DllOpen("gdi32.dll") global $pixel_color, $mag_open = false local $mX, $mY global $hCross = GUICreate('', 48, 48, -1, -1, $WS_POPUP, $WS_EX_TOPMOST) WinSetTrans($hCross, '', 0) GUISetCursor(3, 1, $hCross) global $hZoom = GUICreate("MagPicker", $iMagWidth * $iMagZoom, $iMagHeight * $iMagZoom, _ MouseGetPos(0), MouseGetPos(1), $WS_POPUP+$WS_BORDER, $WS_EX_TOPMOST) global $mag_label = GUICtrlCreateLabel("placehold", (($iMagHeight * $iMagZoom)/2)+2, ($iMagHeight * $iMagZoom) - 13, _ (($iMagHeight * $iMagZoom)/2)-3, 12, $SS_RIGHT) ; put this after the GUICreate()s so that it will not error on startup with mouse already moving. (now trapped! but we will leave them here.) global $__hMouseProc = DllCallbackRegister("_MouseProc", "long", "int;wparam;lparam") global $__hHook = _WinAPI_SetWindowsHookEx($WH_MOUSE_LL, DllCallbackGetPtr($__hMouseProc), _WinAPI_GetModuleHandle(0)) GUISetState(@SW_SHOW, $hCross) GUISetState(@SW_SHOW, $hZoom) $mag_open = true ; once at start, then from the mouse-callback-function.. _Magnify() while $mag_open Sleep(50) $mX = MouseGetPos(0) $mY = MouseGetPos(1) $pixel_color = Hex(PixelGetColor($mX, $mY), 6) GUICtrlSetData ($mag_label, $pixel_color) wend GUIDelete($hZoom) GUIDelete($hCross) ReleaseHooks() endfunc func _Magnify($_iX=-1, $_iY=-1) local Static $fInit = true if $fInit then $fInit = False $hDCDesk = (DLLCall($hUser32, "int", "GetDC", "hwnd", 0))[0] $hDCZoom = (DLLCall($hUser32, "int", "GetDC", "hwnd", $hZoom))[0] $hPen = (DLLCall($hGDI32, "int", "CreatePen", "int", 0, "int", 3, "int", 0x008b9094))[0] ; 0=PS_SOLID, dark-blue (0x00BBGGRR) DLLCall($hGDI32, "int", "SelectObject", "int", $hDCZoom, "hwnd", $hPen) $_iX = MouseGetPos(0) $_iY = MouseGetPos(1) endif local $iW = $iMagWidth * $iMagZoom, $iH = $iMagHeight * $iMagZoom if not @error then DLLCall($hGDI32, "int", "StretchBlt", "int", $hDCZoom, "int", _ 0, "int", 0, "int", $iW, "int", $iH, "int", $hDCDesk, "int", _ $_iX - $iMagWidth/2, "int", $_iY - $iMagHeight/2, "int", $iMagWidth ,"int", $iMagHeight, _ "long", $SRCCOPY) ; draw the crosshair (start x, start y, end x, end y) _GDI32_DrawLine($hDCZoom, ($iW/2)-2, $iH/8, ($iW/2)-2, 4*($iH/8)-6, $hGDI32) ; vertical top _GDI32_DrawLine($hDCZoom, ($iW/2)-2, 5*($iH/8)-10, ($iW/2)-2, 7*($iH/8), $hGDI32) ; vertical bottom _GDI32_DrawLine($hDCZoom, $iW/8, ($iH/2)-2, (3*($iW/8))+6, ($iH/2)-2, $hGDI32) ; horizontal left _GDI32_DrawLine($hDCZoom, 4*($iW/8)+3, ($iH/2)-2, 7*($iW/8), ($iH/2)-2, $hGDI32) ; horizontal right endif endfunc func _GDI32_DrawLine(ByRef $_hDC, $_iX0, $i_Y0, $_iX1, $i_Y1, $_hDll=-1) If $_hDll = -1 then $_hDll = "gdi32.dll" Local $tCurrent = DllStructCreate("struct; long X;long Y; endstruct") DllCall($_hDll, "int", "MoveToEx", "int", $_hDC, "int", $_iX0, "int", $i_Y0, "ptr", DllStructGetPtr($tCurrent)) DllCall($_hDll, "int", "LineTo", "int", $_hDC, "int", $_iX1, "int", $i_Y1) return $tCurrent endfunc func _MouseProc($_nCode, $_wParam, $_lParam) local $tMSLLHOOKSTRUCT = DllStructCreate("struct; long X;long Y; endstruct; " & _ "DWORD mouseData; DWORD flags; DWORD time; ULONG_PTR dwExtraInfo;endstruct", $_lParam) if $_nCode < 0 Then Return _WinAPI_CallNextHookEx($__hHook, $_nCode, $_wParam, $_lParam) local $iX = $tMSLLHOOKSTRUCT.X, $iY = $tMSLLHOOKSTRUCT.Y switch $_wParam case $WM_LBUTTONDOWN CloseMag() case $WM_MOUSEMOVE if not $mag_open then return WinMove($hCross, "", $iX -24, $iY -24) Local $iXz = ($iX +24 + $iMagWidth*$iMagZoom > @DesktopWidth) ? $iX -(24 + $iMagWidth*$iMagZoom) : $iX +24 Local $iYz = ($iY +24 + $iMagHeight*$iMagZoom > @DesktopHeight) ? $iY -(24 + $iMagHeight*$iMagZoom) : $iY +24 WinMove($hZoom, "", $iXz + $iMagWidth/2, $iYz) _Magnify($iX, $iY) endswitch return _WinAPI_CallNextHookEx($__hHook, $_nCode, $_wParam, $_lParam) endfunc func ReleaseHooks() DLLCall($hUser32, "int", "ReleaseDC", "int", $hDCZoom, "hwnd", $hPen) DLLCall($hUser32, "int", "ReleaseDC", "int", $hDCDesk, "hwnd", 0) DLLCall($hUser32, "int", "ReleaseDC", "int", $hDCZoom, "hwnd", 0) DllClose($hUser32) DllClose($hGDI32) _WinAPI_UnhookWindowsHookEx($__hHook) DllCallbackFree($__hMouseProc) endfunc func CloseMag() ; called by mouse left click $mag_open = false endfunc  
      Thanks for any and all insights!
      ;o) Cor
×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.