AndreyS

The problem with using styles GUICtrlCreatePic

17 posts in this topic

Tell me, please, why in the application of different styles($SS_BLACKFRAME, $SS_BLACKRECT, etc.) of frames stops working function Msg().

And why in the application of certain frame styles($SS_BLACKFRAME) do not even picture displayed?

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>

Opt("GUIOnEventMode", 1)

Example()

Func Example()
    GUICreate("My GUI picture", 350, 300, -1, -1) ; will create a dialog box that when displayed is centered
    GUISetOnEvent($GUI_EVENT_CLOSE,"Quit")

    $idPic = GUICtrlCreatePic("D:\Program Files\AutoIt3\Examples\GUI\mslogo.jpg", 50, 50, 200, 50, $SS_SUNKEN)
    GUICtrlSetOnEvent(-1,"Msg")

    GUISetState(@SW_SHOW)

    ; Loop until the user exits.
    While 1

    WEnd


EndFunc   ;==>Example

Func Msg()
    MsgBox(0,0,0)
EndFunc

Func Quit()
    Exit
EndFunc

 

Share this post


Link to post
Share on other sites



AndreyS,

When you specify styles when creating a control you overwrite the default styles set by AutoIt. For a picture control, the default style is $SS_NOTIFY, so by only specifying another style you remove that style and so will not get notification of a click. By re-adding the style, the script works as you require:

$idPic = GUICtrlCreatePic("M:\Program\AutoIt3\Examples\GUI\mslogo.jpg", 50, 50, 200, 50, BitOr($SS_SUNKEN, $SS_NOTIFY))

The Setting Styles tutorial in the Wiki explains in more detail.

M23

 

1 person likes this

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

Ah, that's it! Thank you, Melba23!

And why in the application of certain frame styles($SS_BLACKFRAME) do not even picture displayed?

 

Share this post


Link to post
Share on other sites

$SS_BLACKFRAME is just a frame around the picture control, you can't specify a picture or text inside it. You have to create 2 different controls in the same area if you want to use a frame or RECT style.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

That's it! Approximately realized. It would be nice to see an example of how to use it.

Share this post


Link to post
Share on other sites
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>

Example()

Func Example()
    GUICreate("My GUI picture", 350, 300, -1, -1, $WS_SIZEBOX + $WS_SYSMENU) ; will create a dialog box that when displayed is centered

    GUISetBkColor(0xE0FFFF)
    Local $idPic = GUICtrlCreatePic("E:\Release\AutoIt3\Examples\GUI\Advanced\Images\green.bmp", 50, 50, 200, 50) ; change this path according to where you have autoit installed
    GUICtrlCreateLabel("", 50, 50, 200, 50, $ss_blackframe)
    GUISetState(@SW_SHOW)

    ; Loop until the user exits.

    Local $idMsg
    ; Loop until the user exits.
    While 1
        $idMsg = GUIGetMsg()

        If $idMsg = $GUI_EVENT_CLOSE Then ExitLoop
    WEnd

    GUIDelete()
EndFunc   ;==>Example

This should do it.

1 person likes this

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

Thank you, BrewManNH, for your example!
It turns out that this style is no point to use with the Picture? It applies only to Label?

Tell me then, please, how can I when you click on the picture highlight it in some way? The frame, brightness, or opacity change it. To make it visible that the user clicks on it.

Share this post


Link to post
Share on other sites

AndreyS,

I always use an underlaid label like this:

#include <GUIConstantsEx.au3>

$hGUI = GUICreate("Test", 500, 500)

$cHiLite_1 = GUICtrlCreateLabel("", 5, 5, 110, 110)
GUICtrlSetState($cHiLite_1, $GUI_DISABLE)
$cButton_1 = GUICtrlCreateLabel("Press me 1", 10, 10, 100, 100)
GUICtrlSetBkColor($cButton_1, 0xCCFFCC)
$cHiLite_2 = GUICtrlCreateLabel("", 155, 5, 110, 110)
GUICtrlSetState($cHiLite_2, $GUI_DISABLE)
$cButton_2 = GUICtrlCreateLabel("Press me 2", 160, 10, 100, 100)
GUICtrlSetBkColor($cButton_2, 0xCCFFCC)

GUISetState()

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $cButton_1
            GUICtrlSetBkColor($cHiLite_1, 0xFF0000)
            GUICtrlSetBkColor($cHiLite_2, 0xFEFEFE)
        Case $cButton_2
            GUICtrlSetBkColor($cHiLite_2, 0xFF0000)
            GUICtrlSetBkColor($cHiLite_1, 0xFEFEFE)
    EndSwitch

WEnd

M23

1 person likes this

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

Melba23, thank you for the example of a good and clear!
But I really need to organize the allocation without additional controls. Only by using the properties and styles control Picture.

There is a possibility?

 

Share this post


Link to post
Share on other sites

AndreyS,

Not as far as I know - which is why I suggested the underlaid labels.

Why do you not want the added controls? With a couple of helper functions it is really easy to code:

#include <GUIConstantsEx.au3>

$hGUI = GUICreate("Test", 500, 500)

$cButton_1 = _CreateButton("Press me 1", 10, 10, 100, 100)
$cButton_2 = _CreateButton("Press me 2", 150, 10, 100, 100)

GUISetState()

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $cButton_1
            _ColourBorder($cButton_1, 0xFF0000)
            _ColourBorder($cButton_2, 0xFEFEFE)
        Case $cButton_2
            _ColourBorder($cButton_2, 0xFF0000)
            _ColourBorder($cButton_1, 0xFEFEFE)
    EndSwitch

WEnd

Func _CreateButton($sText, $iX, $iY, $iW, $iH, $iB = 5)

    Local $cHilite = GUICtrlCreateLabel("", $iX - $iB, $iY - $iB, $iW + ($iB * 2), $iH + ($iB * 2))
    GUICtrlSetState($cHilite, $GUI_DISABLE)
    Local $cButton = GUICtrlCreateLabel($sText, $iX, $iY, $iW, $iH)
    GUICtrlSetBkColor($cButton, 0xCCFFCC)
    Return $cButton

EndFunc

Func _ColourBorder($cCID, $iColour)

    GUICtrlSetBkColor($cCID - 1, $iColour)

EndFunc

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

Yes, I see it clearly and simply.
I did not want to add additional controls, as I have, and so the program contains a lot of controls (they probably already a few hundred). In order to once again not to load it, and not take up resources.

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

Melba23,i realized that really the best use label for my task. Thus the frame can be made of any thickness and color. And in order not to create Label under each picture, I just move this Labelle when clicked by function GUICtrlSetPos().


Thank you all for your active support!

Edited by AndreyS

Share this post


Link to post
Share on other sites

AndreyS,

Quote

 I just move this Labelle when clicked by function GUICtrlSetPos().

An interesting solution. Glad you got it sorted.

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

#14 ·  Posted

An additional problem I have with this control.
Can you please tell how to make the picture does not change the size of $ idPic?

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#include <ScreenCapture.au3>


Opt("GUIOnEventMode", 1)

Example()

Func Example()
    Global $form=GUICreate("My GUI picture", 350, 300, -1, -1)
    GUISetOnEvent($GUI_EVENT_CLOSE,"Quit")

    Global $idPic = GUICtrlCreatePic("", 50, 50, 250, 200)
    GUICtrlSetOnEvent(-1,"Msg")

    GUISetState(@SW_SHOW)

    ; Loop until the user exits.
    While 1

    WEnd

EndFunc   ;==>Example

Func Msg()
    GUICtrlSendMsg($idPic, $STM_SETIMAGE, 0, _ScreenCapture_Capture(""))
EndFunc

Func Quit()
    Exit
EndFunc

 

Share this post


Link to post
Share on other sites

#15 ·  Posted

AndreyS,

I think you will need GDI to set the picture to the correct size before loading it - I am sure UEZ has shown how to do this somewhere.

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

#16 ·  Posted

I decide it this way, but not to understand why control $idPic is so weird ?!

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#include <ScreenCapture.au3>


Opt("GUIOnEventMode", 1)

Example()

Func Example()
    Global $form=GUICreate("My GUI picture", 350, 300, -1, -1)
    GUISetOnEvent($GUI_EVENT_CLOSE,"Quit")

    Global $idPic = GUICtrlCreatePic("", 50, 50, 250, 200)
    GUICtrlSetOnEvent(-1,"Msg")

    GUISetState(@SW_SHOW)

    ; Loop until the user exits.
    While 1

    WEnd

EndFunc   ;==>Example

Func Msg()
    Local $arPosPicPres = ControlGetPos($form,"", $idPic)
    GUICtrlSendMsg($idPic, $STM_SETIMAGE, 0, _ScreenCapture_Capture(""))
    GUICtrlSetPos($idPic,$arPosPicPres[0],$arPosPicPres[1],$arPosPicPres[2]-1, $arPosPicPres[3])
    GUICtrlSetPos($idPic,$arPosPicPres[0],$arPosPicPres[1],$arPosPicPres[2]+1, $arPosPicPres[3])
EndFunc

Func Quit()
    Exit
EndFunc


As it is easier and do the right thing? This method also does not work. When many times installed image, the control $idPic somehow reduces its size.

Share this post


Link to post
Share on other sites

#17 ·  Posted

If no one knows how to solve it. So tell me why it is at least strange behavior GUICtrlSetPos() applied to the $idPic? Why suddenly change the size of $idPic?

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

    • Skysnake
      By Skysnake
      Hello
      So I thought it would be cool to use my Gravatar account to display my gravatar in a local GUI.
      I use this code:
      #cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.14.2 Author: Skysnake Script Function: Example to download avatar from Gravatar and display locally #ce ---------------------------------------------------------------------------- ; Script Start ; includes #include <Crypt.au3> #include <InetConstants.au3> #include <MsgBoxConstants.au3> #include <WinAPIFiles.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> ; declare Global vars Global $md5GraMail = '' ; will store email for Grvatar request request GravatarLogin() GetAvatar() Func GravatarLogin() ; get the email required for downloading the Gravatar Local $sGraMail = InputBox("Get Gravatar", "What is your email registered with Gravatar?", "someone@somewhere.com", "", -1, -1, 0, 0) ; from http://en.gravatar.com/site/implement/hash/ ; make the hash ; Local $dHash = _Crypt_HashData(GUICtrlRead($g_idInputEdit), $g_iAlgorithm) ; Create a hash of the text entered $md5GraMail = _Crypt_HashData(StringLower(StringStripWS($sGraMail, 8)), $CALG_MD5) ; lose the left two '0x' chars and convert to lower case $md5GraMail = StringLower(StringTrimLeft($md5GraMail, 2)) ; Display the result. MsgBox($MB_SYSTEMMODAL, "", $sGraMail & @CRLF & "md5 " & $md5GraMail, 15) EndFunc ;==>GravatarLogin ; example from Help file: /html/functions/InetGet.htm ; Download a file in the background. ; Wait for the download to complete. Func GetAvatar() ; Save the downloaded file to the temporary folder. Local $sFilePath = _WinAPI_GetTempFileName(@TempDir) ; from http://en.gravatar.com/site/implement/images/ ; <img src="https://www.gravatar.com/avatar/205e460b479e2e5b48aec07710c08d50" /> ; Download the file in the background with the selected option of 'force a reload from the remote site.' ; the next THREE options are alternatives ; Gravatar sample from here http://en.gravatar.com/site/implement/images/ ; 1 ;Local $hDownload = InetGet("https://www.gravatar.com/avatar/205e460b479e2e5b48aec07710c08d50", $sFilePath, $INET_FORCERELOAD, $INET_DOWNLOADBACKGROUND) ; the normal code, should show user avatar ; 2 Local $hDownload = InetGet("https://www.gravatar.com/avatar/" & $md5GraMail & "?d=retro", $sFilePath, $INET_FORCERELOAD, $INET_DOWNLOADBACKGROUND) ; my email hardcoded, downloads, but does not show avatar ; 3 ;Local $hDownload = InetGet("https://www.gravatar.com/avatar/cac637b47c9fecc8aa1dcdf71e7a4cc8", $sFilePath, $INET_FORCERELOAD, $INET_DOWNLOADBACKGROUND) ; Wait for the download to complete by monitoring when the 2nd index value of InetGetInfo returns True. Do Sleep(250) Until InetGetInfo($hDownload, $INET_DOWNLOADCOMPLETE) ; Retrieve the number of total bytes received and the filesize. Local $iBytesSize = InetGetInfo($hDownload, $INET_DOWNLOADREAD) Local $iFileSize = FileGetSize($sFilePath) ; Close the handle returned by InetGet. InetClose($hDownload) ; Display details about the total number of bytes read and the filesize. MsgBox($MB_SYSTEMMODAL, "", "The total download size: " & $iBytesSize & @CRLF & _ "The total filesize: " & $iFileSize, 1) Local $MyGravatar = @ScriptDir & "\Gravatar.jpg" FileCopy($sFilePath, $MyGravatar) MsgBox(0, "Now showing!", $MyGravatar, 5) ; make gui and show file GUICreate("My Gravatar in a GUI " & $MyGravatar, 350, 300, -1, -1, $WS_SIZEBOX + $WS_SYSMENU) ; will create a dialog box that when displayed is centered Local $idPic = GUICtrlCreatePic($MyGravatar, 50, 50, 80, 80) GUISetState(@SW_SHOW) ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd ;FileDelete($MyGravatar) ; Delete the file. FileDelete($sFilePath) EndFunc ;==>GetAvatar Now, here is the issue.
      If I use the example from the Gravatar site, located here:
      http://en.gravatar.com/site/implement/images/
      Then this code  205e460b479e2e5b48aec07710c08d50  downloads this pic   (not me)
      AND it displays correctly.
       
      PROBLEM
      However, If I download my own Gravatar, I see the image in the @Script folder, BUT IT DOES NOT DISPLAY.  The same with the retro image.  To be clear, this image   downloads, but is not displayed.
       
      I guess it has something to do with the format of my gravatar. Or that the display funtion GUICtrlCreatePic() does not like my gravatar.
      I would be grateful if someone would be willing to test this and may offer a suggestion or two... 
      Skysnake
       
    • FrancescoDiMuro
      By FrancescoDiMuro
      Good morning
      I was looking around the forum if there were some customizable solutions about creating a PDF from "0" to something like a report...
      What I'd like to do is something with a header ( 2 logos and a title ), with a table which contains data read from a file
      At the moment, I was working with HTML, since I know it and it's very simple to do a table with some data inside...
      But know, I'm a bit stuck about the exporting the HTML page to PDF... And, here too, if someone knows how to do it, please, I'm here listening
      Thanks guys
       
    • AndreyS
      By AndreyS
      Please tell me, who knows how to apply and cancel styles in RTF?
      The following code does not work:
      #include <GuiRichEdit.au3> #include <WindowsConstants.au3> $hGUI = GUICreate("RichEdit Style", 500, 500, -1, -1) $hRichEdit = _GUICtrlRichEdit_Create($hGui, "Test", 20,40,460,400) GUISetState(@SW_SHOW, $hGUI) Sleep(3000) GUICtrlSetStyle($hRichEdit, $ES_RIGHT) Sleep(3000) GUICtrlSetStyle($hRichEdit, -1) Sleep(3000) Thanks!
    • tarretarretarre
      By tarretarretarre
      Inspired from

      I created a UDF that I have been using to replace GUICtrlSetOnEvent, not using Opt("GUIOnEventMode").
      AutoIt's GUICtrlSetOnEvent function only supports mouse clicks without parameters at this moment, this UDF works on the same premise but gives the user some more flexibility, in just 61 lines of code.
      Here is an example of what A callback will look like
      Func MyCallBackFunction(Const $wParam, ByRef $iCtrlId, ByRef $uData, ByRef $hWnd) Switch $wParam Case $WM_HOVERIN ConsoleWrite("Entering control; attached data = " & $uData & @CRLF) Case $WM_HOVEROUT ConsoleWrite("Leaving control" & @CRLF) Case $WM_LBUTTONDOWN ConsoleWrite("Left mousebutton DOWN" & @CRLF) Case $WM_LBUTTONUP ConsoleWrite("Left mousebutton UP" & @CRLF) Case $WM_MBUTTONDOWN ConsoleWrite("Middle mousebutton DOWN" & @CRLF) Case $WM_MBUTTONUP ConsoleWrite("Middle mousebutton UP" & @CRLF) Case $WM_RBUTTONDOWN ConsoleWrite("Right mousebutton DOWN" & @CRLF) Case $WM_RBUTTONUP ConsoleWrite("Right mousebutton UP" & @CRLF) EndSwitch EndFunc  
      More examples can be found in the zip file.
      Good 2 know
      GuiDelete($hWnd) used together with $WM_LBUTTONUP will cause the AutoIt script to crash $WM_HOVERIN and $WM_HOVEROUT ARE NOT real Windows Message codes and will only work with with this UDF Your callback functions MUST have 4 parameters assigned to it. That's about it.
      Feel free to pitch some improvements.
      /Tarre
       
      _GuiCtrlSetOnEvent.zip
    • Tankbuster
      By Tankbuster
      Hello,
      A small tool from me opens certain text files and displays the content in some sort of "preview", by chance a user selected a file that is "large" ~ 10 MB. (of course my test files are small enough :-) )
      But this takes very long (~ 4 secs on that pc), first I thought it is reading the file but I stripped it down to the edit control update.
       
      I extracted the issue to a sample au3 attached and a sample large file.  The log lines are from the dummy1.au3.
      (11:19:40.352) - -->Line0017):    openfile
      (11:19:40.461) - -->Line0021):    closefile
      (11:19:40.461) - -->Line0022):    update ctrlfile start
      (11:19:45.581) - -->Line0024):    update ctrlfile done
      I see that reading the file is fast enough( 109ms) , but the edit control update takes long (5120 ms).
       
      Question: Based on the dummy1, is there a chance to speed up? I'm open to accept also other advices, the purpose of the edit is just to display the file and allow scrolling.
      I thought about reading only a certain amount of lines and if the user scrolls read the rest.....or so.
      Or is it just like this by design. Or what is more likely, what is wrong on my code?
       
      Of course my real app displays now in the mean time something like "Loading...." but that does not solve it.
      And yes, I used FS. Found something similar, but the thread was drifting apart from the issue without solving it...
       
      dummy1.au3
      largetextfile.txt