Jump to content
Sign in to follow this  
Lupo73

[SOLVED] InfoTip is behind the main window

Recommended Posts

Lupo73

I have created this application with AutoIt:

https://sourceforge.net/projects/arcthemall/

Now, when the "Always on top" feature is active, the InfoTip feature to show long strings in the ListView doesn't work, tips are shown behind the main window. There is a way to set that info tips are the "most topmost" and appear in front of the window? Thanks!

Edited by Lupo73

SFTPEx, AutoCompleteInput_DateTimeStandard(), _ImageWriteResize()_GUIGraduallyHide(): some AutoIt functions.

Lupo PenSuite: all-in-one and completely free selection of portable programs and games.

DropIt: a personal assistant to automatically manage your files.

ArcThemALL!: application to multi-archive your files and folders.

Share this post


Link to post
Share on other sites
martin

I have created this application with AutoIt:

https://sourceforge.net/projects/arcthemall/

Now, when the "Always on top" feature is active, the InfoTip feature to show long strings in the ListView doesn't work, tips are shown behind the main window. There is a way to set that info tips are the "most topmost" and appear in front of the window? Thanks!

We can't really say if there's no source to see, so I'll make a guess.

I've had a similar problem with dialogs. I set a window to be on top, then if that window opens a FIleOpenDialog say, then the dialog will be hidden by the window. So what I do is

WinSetOnTop($gui,0)
$ans = FileOpenDialog(...
WinSetOnTop($Gui,1)

With Tooltips this is not so easy because you don't know when the tool tip will be shown. So you could have a timer, using _Timer_SetTimer or AdLibEnable, and check what the currently active window is. If the active window changes and is not a tooltip and not your gui then WInSetOnTop($gui,1) WinSetOnTop($gui,0).


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
rover

I have created this application with AutoIt:

https://sourceforge.net/projects/arcthemall/

Now, when the "Always on top" feature is active, the InfoTip feature to show long strings in the ListView doesn't work, tips are shown behind the main window. There is a way to set that info tips are the "most topmost" and appear in front of the window? Thanks!

@Lupo73

Welcome to the forums

you can intercept the listviews $LVN_GETINFOTIP message, get the handle to the tooltip

and then use WinSetOnTop()

see if this works

Cheers

Edit1: forgot to mention the example is a rework of an example by Rasim

Edit2: added declaration for '$hToolTip' in the WM_NOTIFY() function

added Opt('MustDeclareVars', 1), declared vars for script

#include <GUIConstantsEX.au3>
#include <Constants.au3>
#include <WindowsConstants.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>

Global $Gui, $hListView, $hImage, $msg

$Gui = GUICreate("Test", 320, 220, -1, -1, -1, $WS_EX_TOPMOST)
$hListView = _GUICtrlListView_Create($Gui, "Items|SubItems1|SubItems2", 10, 10, 300, 200, _
        BitOR($LVS_EDITLABELS, $LVS_REPORT), $WS_EX_CLIENTEDGE)
_GUICtrlListView_SetExtendedListViewStyle($hListView, _
        BitOR($LVS_EX_SUBITEMIMAGES, $LVS_EX_FULLROWSELECT, $LVS_EX_INFOTIP))

_GUICtrlListView_SetColumnWidth($hListView, 0, 98)
_GUICtrlListView_SetColumnWidth($hListView, 1, 98)
_GUICtrlListView_SetColumnWidth($hListView, 2, 98)

$hImage = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hImage, "shell32.dll", 3)
_GUIImageList_AddIcon($hImage, "shell32.dll", 11)
_GUIImageList_AddIcon($hImage, "shell32.dll", 22)
_GUIImageList_AddIcon($hImage, "shell32.dll", 33)

_GUICtrlListView_SetImageList($hListView, $hImage, 1)

_GUICtrlListView_AddItem($hListView, "Some long name item1", 0)
_GUICtrlListView_AddItem($hListView, "Some long name item2", 2)
_GUICtrlListView_AddItem($hListView, "Some long name item3", 1)
_GUICtrlListView_AddItem($hListView, "Some long name item4", 3)

_GUICtrlListView_AddSubItem($hListView, 0, '44', 1, 2)
_GUICtrlListView_AddSubItem($hListView, 1, '22', 1, 1)
_GUICtrlListView_AddSubItem($hListView, 2, '11', 1, 0)
_GUICtrlListView_AddSubItem($hListView, 3, '33', 1, 3)

_GUICtrlListView_AddSubItem($hListView, 0, 'New', 2, 1)
_GUICtrlListView_AddSubItem($hListView, 1, 'Page', 2, 3)
_GUICtrlListView_AddSubItem($hListView, 2, 'Sys', 2, 2)
_GUICtrlListView_AddSubItem($hListView, 3, 'Device', 2, 0)

GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
GUISetState()

While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $GUI_EVENT_CLOSE
            ExitLoop
    EndSwitch
WEnd

Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
    #forceref $hWnd, $iMsg, $iwParam
    Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView, $tInfo, $hToolTip
    $hWndListView = $hListView
    If Not IsHWnd($hListView) Then $hWndListView = GUICtrlGetHandle($hListView)

    $tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
    $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
    $iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
    $iCode = DllStructGetData($tNMHDR, "Code")
    Switch $hWndFrom
        Case $hWndListView
            Switch $iCode
                Case $LVN_GETINFOTIP ; Sent by a large icon view list-view control that has the $LVS_EX_INFOTIP extended style
                    $hToolTip = _GUICtrlListView_GetToolTips($hListView)
                    If IsHWnd($hToolTip) Then WinSetOnTop($hToolTip, "", 1)
;~                  $tInfo = DllStructCreate($tagNMLVGETINFOTIP, $ilParam)
;~                  $tBuffer = DllStructCreate("char Text[" & DllStructGetData($tInfo, "TextMax") & "]", DllStructGetData($tInfo, "Text"))
;~                  ConsoleWrite("$LVN_GETINFOTIP" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
;~                          "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
;~                          "-->Code:" & @TAB & $iCode & @LF & _
;~                          "-->Flags:" & @TAB & DllStructGetData($tInfo, "Flags") & @LF & _
;~                          "-->Text:" & @TAB & DllStructGetData($tBuffer, "Text") & @LF & _
;~                          "-->TextMax:" & @TAB & DllStructGetData($tInfo, "TextMax") & @LF & _
;~                          "-->Item:" & @TAB & DllStructGetData($tInfo, "Item") & @LF & _
;~                          "-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
;~                          "-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam"))
            EndSwitch
    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_NOTIFY
Edited by rover

I see fascists...

Share this post


Link to post
Share on other sites
Lupo73

It seem to be the correct way to solve my problem, but I can't understand very well how to implement this code in my own. I have tried to add the WM_NOTIFY function, but it doesn't work. Can you write me some more accurate info about what part of that code I need to implement in mine? Thanks!


SFTPEx, AutoCompleteInput_DateTimeStandard(), _ImageWriteResize()_GUIGraduallyHide(): some AutoIt functions.

Lupo PenSuite: all-in-one and completely free selection of portable programs and games.

DropIt: a personal assistant to automatically manage your files.

ArcThemALL!: application to multi-archive your files and folders.

Share this post


Link to post
Share on other sites
rover

It seem to be the correct way to solve my problem, but I can't understand very well how to implement this code in my own. I have tried to add the WM_NOTIFY function, but it doesn't work. Can you write me some more accurate info about what part of that code I need to implement in mine? Thanks!

Hi Lupo73, nice website you have there.

what AutoIt version are you using?

add GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") just before your main loop, before GUISetState()

add WM_NOTIFY() function to bottom of script

replace all 4 instances of $hListView in WM_NOTIFY() with your variable name for _GUICtrlListView_Create()

see the code I originally posted above as I updated it with a minor correction

was missing local declaration for $hToolTip in WM_NOTIFY()


I see fascists...

Share this post


Link to post
Share on other sites
Lupo73

Hi Lupo73, nice website you have there.

what AutoIt version are you using?

Thank you. I use the version 3.2.12.1

I have tried to do it, but it doesn't work fine. I have added the source code to this post. Lines that I changed are at the end of the code. Tell me if you can to understand where is the error. Thanks!


SFTPEx, AutoCompleteInput_DateTimeStandard(), _ImageWriteResize()_GUIGraduallyHide(): some AutoIt functions.

Lupo PenSuite: all-in-one and completely free selection of portable programs and games.

DropIt: a personal assistant to automatically manage your files.

ArcThemALL!: application to multi-archive your files and folders.

Share this post


Link to post
Share on other sites
Lupo73

I think to have understood what is the problem:

- in my code I use "GuiCtrlCreateListView" to create the listview (not "_GUICtrlListView_Create" as in your code)

- this doesn't support that feature, so if I implement that code it doesn't work fine

- I thought the solution may be to "migrate" to the other "set of functions"

- but I saw that the listview created with these new functions doesn't support drag&drop of files (a feature essential for my app)

I'm not sure (I'll try it tomorrow), can you help me to understand if it is the true error and in this case to solve this new problem? thanks..


SFTPEx, AutoCompleteInput_DateTimeStandard(), _ImageWriteResize()_GUIGraduallyHide(): some AutoIt functions.

Lupo PenSuite: all-in-one and completely free selection of portable programs and games.

DropIt: a personal assistant to automatically manage your files.

ArcThemALL!: application to multi-archive your files and folders.

Share this post


Link to post
Share on other sites
rover

I think to have understood what is the problem:

- in my code I use "GuiCtrlCreateListView" to create the listview (not "_GUICtrlListView_Create" as in your code)

- this doesn't support that feature, so if I implement that code it doesn't work fine

- I thought the solution may be to "migrate" to the other "set of functions"

- but I saw that the listview created with these new functions doesn't support drag&drop of files (a feature essential for my app)

I'm not sure (I'll try it tomorrow), can you help me to understand if it is the true error and in this case to solve this new problem? thanks..

Hi Lupo73

found the problem with a look at the WM_NOTIFY messages.

you need to add Unicode version of LVN_GETINFOTIP constant $LVN_GETINFOTIPW

works with the standard GUICtrlCreateListView()

Message for LVN_GETINFOTIP:

Standard: GUICtrlCreateListView() $iCode = -158 : Unicode

UDF: _GUICtrlListView_Create() $iCode = -157 : Ansi

tested with above example and your code

Global Const $LVN_FIRST = -100
Global Const $LVN_GETINFOTIPA = ($LVN_FIRST - 57)
Global Const $LVN_GETINFOTIPW = ($LVN_FIRST - 58)
Global Const $LVN_GETINFOTIP = $LVN_GETINFOTIPA

Switch $hWndFrom
    Case $hWndListView
        Switch $iCode
            Case $LVN_GETINFOTIP, $LVN_GETINFOTIPW
                $hToolTip = _GUICtrlListView_GetToolTips($hListView)
                If IsHWnd($hToolTip) Then WinSetOnTop($hToolTip, "", 1)
        EndSwitch
EndSwitch
Edited by rover

I see fascists...

Share this post


Link to post
Share on other sites
rover

ok, what i found was the handle for the tooltip is created when the listview is so:

dump the guiregistermsg line and the wm_notify function!

replace your lister function with this

Func Lister($hListView)

    $hListView = GuiCtrlCreateListView($upp, 11, 43, 455, 190, $LVS_NOSORTHEADER, $WS_EX_CLIENTEDGE)
    GUICtrlSetState($hListView, $GUI_DROPACCEPTED)
    _GUICtrlListView_SetExtendedListViewStyle($hListView, BitOr($LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES, $LVS_EX_INFOTIP))
    Local $hToolTip = _GUICtrlListView_GetToolTips($hListView)
    If IsHWnd($hToolTip) Then
        WinSetOnTop($hToolTip, "", 1)
        _GUIToolTip_SetDelayTime($hToolTip, 3, 50) ; speeds up infotip appearance
    EndIf
    Return $hListView
EndFunc

I see fascists...

Share this post


Link to post
Share on other sites
rover

one additional thing I find is the tooltip sometimes doesn't appear for column shortened long name subitems.

Rasim has a post on this somewhere on the forum


I see fascists...

Share this post


Link to post
Share on other sites
Lupo73

one additional thing I find is the tooltip sometimes doesn't appear for column shortened long name subitems.

Rasim has a post on this somewhere on the forum

I can't find this new problem. Anyway this code I upload seem to work fine. Thank you very much!

Now, I'd like to make my code as lite as possible (both for exe dimension in KB and RAM usage), can you help me to improve it? thanks!

ArcThemAll__ok.zip


SFTPEx, AutoCompleteInput_DateTimeStandard(), _ImageWriteResize()_GUIGraduallyHide(): some AutoIt functions.

Lupo PenSuite: all-in-one and completely free selection of portable programs and games.

DropIt: a personal assistant to automatically manage your files.

ArcThemALL!: application to multi-archive your files and folders.

Share this post


Link to post
Share on other sites
rover

I can't find this new problem. Anyway this code I upload seem to work fine. Thank you very much!

Now, I'd like to make my code as lite as possible (both for exe dimension in KB and RAM usage), can you help me to improve it? thanks!

I haven't looked over the script in depth, but I can offer some suggestions.

I see you have programming experience, but want AutoIt specific details?

skip over anything I bring up here you already know

as AutoIt is an interpreted scripting language and creates larger executables than a compiled language

there are limitations on how small an executable you get, the binary stub file adds around 500kb.

AutoIt is also slower for some things compared to a compiled language and is single threaded.

you can use the Obfuscator program included with the SciTE editor package (download full package if you don't already have it)

(or download it separately from the SciTE downloads page).

and run with the '/striponly' option - removes unused global vars and functions in script and all includes

this will reduce size of script, I see you already added only the constants you needed to the script.

if you haven't been reading the forums very long

you'll see with a quick search, that the UPX compression/AV topic has been done to death.

AutoIt exes compressed with UPX (or not) get tagged as virus/trojan by many AV products every now and then.

memory usage is a tough one, besides deleting unused resources, variables, arrays etc.

it seems memory usage is quite high compared to programs compiled in a low level language.

can't help you with that one, maybe others will weigh in, or search the forum.

there is a '_ReduceMemory()' function on the forum that uses call to EmptyWorkingSet but

I think it pages out ram to the paging file. search for it.

your 'About' messagebox needs

flag parameter changed to 262144, it appears behind the gui

when option for 'always on top' is set.

for optimizing look into:

OnEventMode instead of message loop

move some of the code in the main loop Select statement out into functions

and use Switch/Case/Endswitch instead of Select/Case/EndSelect

Switch $msg
    Case $GUI_EVENT_CLOSE
    Case $GUI_EVENT_DROPPED
    Case $radio1
    Case $r1
    Case $radio2
    Case $r2
    Case $rad1
    Case $rr1
    Case $rad2
    Case $rr2
    Case $rad3
    Case $rr3
    Case $add
    Case $del
    Case $clear
    Case $out   
    Case $go
    Case $options
    Case $about
EndSwitch

use Run command with $STDERR_CHILD + $STDOUT_CHILD to get data

from the console output on compression progress instead of using a While loop with Sleep()

see helpfile examples and the many examples on the forum.

ProcessSetPriority(@AutoItPID, 3) to raise your scripts priority or use with external compressors run from your script.

for your file/folder search try out Smashlys

'_FileListToArrayR()' recursive search

concatenate search results into a string with a delimiter then stringsplit to array to populate listview.

populating the listview while searching is definitely one bottleneck

look into the various methods on the forum for running scripts externally to get a parallel process

there are probably other things I have overlooked and others wont, so post away in the forums!

glad the tooltip fix worked out.

Ciao


I see fascists...

Share this post


Link to post
Share on other sites
Lupo73

Thank you for all your advices, when I will have more time I try to work on a new improved version of my app. Anyway now seem to be fine, you can try the stable release from its page https://sourceforge.net/projects/arcthemall/

Finally, if you would like to develop some good portable software, you can think to collaborate with our project. I'm working also on other small tools (in autoit) and I have many ideas that needs only a collaborator to work on. :)


SFTPEx, AutoCompleteInput_DateTimeStandard(), _ImageWriteResize()_GUIGraduallyHide(): some AutoIt functions.

Lupo PenSuite: all-in-one and completely free selection of portable programs and games.

DropIt: a personal assistant to automatically manage your files.

ArcThemALL!: application to multi-archive your files and folders.

Share this post


Link to post
Share on other sites
rover

Thank you for all your advices, when I will have more time I try to work on a new improved version of my app. Anyway now seem to be fine, you can try the stable release from its page https://sourceforge.net/projects/arcthemall/

Finally, if you would like to develop some good portable software, you can think to collaborate with our project. I'm working also on other small tools (in autoit) and I have many ideas that needs only a collaborator to work on. :)

Hi Lupo73

I'll check out the app.

If I have the time, I can always beta test.

at the moment I have enough things on the go.

and of course I'm still climbing the learning curve

with scripting. >_<


I see fascists...

Share this post


Link to post
Share on other sites
Lupo73

How can I embed images in the exe? I'd like to include icons used in the gui of the app to the exe, is it possible?


SFTPEx, AutoCompleteInput_DateTimeStandard(), _ImageWriteResize()_GUIGraduallyHide(): some AutoIt functions.

Lupo PenSuite: all-in-one and completely free selection of portable programs and games.

DropIt: a personal assistant to automatically manage your files.

ArcThemALL!: application to multi-archive your files and folders.

Share this post


Link to post
Share on other sites
Lupo73

I'd like also to add the support for multiple drag&drop, is it possible? To make my app able to load many selected files at the same time (with only one drag&drop). thanks!


SFTPEx, AutoCompleteInput_DateTimeStandard(), _ImageWriteResize()_GUIGraduallyHide(): some AutoIt functions.

Lupo PenSuite: all-in-one and completely free selection of portable programs and games.

DropIt: a personal assistant to automatically manage your files.

ArcThemALL!: application to multi-archive your files and folders.

Share this post


Link to post
Share on other sites
rover

How can I embed images in the exe? I'd like to include icons used in the gui of the app to the exe, is it possible?

I'd like also to add the support for multiple drag&drop, is it possible? To make my app able to load many selected files at the same time (with only one drag&drop).

thanks!

Hi Lupo73

you should re-title this thread as: [sOLVED] InfoTip is behind the main window

as this is seems to be the forum suggested method of finalizing a thread once the 'OP' (original poster)

has their answer. :)

I suggest you read the 'Welcome Bot' 'Community On Patrol' message now being posted on various

threads on the forum directed to new users regarding using the forum search engine.

BTW, the search engine will reject search terms of 3 or less characters

so use quotes when searching for phrases or use a Google site search

"drag and drop"

"drag and drop files"

"drag files"

"drag & drop"

"drag & drop files"

using these search terms I could easily find an answer to using drag and drop of multiple files on a listview

Drop multiple files on any control, With GUIRegisterMsg

Drag and Drop GUI

Drag&Drop in ListView

Drag multiple files to list

[solved]_@GUI_DRAGFILE, What if i drag multiple files

Can't get files dropped onto gui to be accepted.

If necessary, start a new topic if you need help with your code

after searching the forum for similar post topics.

and try to keep to one subject per post

this forum is overloaded and littered with posts

asking the same not difficult to search for questions over and over again

as if they were asked for the first time.

and if you can, help answer questions of other new forum members. >_<

for embedding resources this is what you need:

Add and use binary data to/from resources

this UDF will embed icon, bitmap, data etc resources

internally in your exe without having to fileinstall to hard disk.

read the entire thread and download Reshacker if you don't have it.

(search the SciTe helpfile or the forum for a download link)

good luck

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


Global Const $WM_DROPFILES = 0x233
Global $gaDropFiles[1]

$hGUI = GUICreate("", 400, 300, -1, -1, -1, $WS_EX_ACCEPTFILES)
GUISetBkColor(0xFFFFFF)

$listview = GUICtrlCreateListView("Drag and drop files here", 10, 10, 380, 150)
GUICtrlSetState(-1, $GUI_DROPACCEPTED)

GUIRegisterMsg ($WM_DROPFILES, "WM_DROPFILES_FUNC")
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $GUI_EVENT_DROPPED
            For $i = 0 To UBound($gaDropFiles) - 1
                GUICtrlCreateListViewItem($gaDropFiles[$i], $listview)
                _GUICtrlListView_SetColumnWidth(GUICtrlGetHandle($listview), 0, $LVSCW_AUTOSIZE)
                ConsoleWrite("+" &$gaDropFiles[$i] & @CR)
            Next
    EndSwitch
WEnd

Func WM_DROPFILES_FUNC($hWnd, $msgID, $wParam, $lParam)
    ;Author: Lazycat
    Local $nSize, $pFileName
    Local $nAmt = DllCall("shell32.dll", "int", "DragQueryFile", "hwnd", $wParam, "int", 0xFFFFFFFF, "ptr", 0, "int", 255)
    For $i = 0 To $nAmt[0] - 1
        $nSize = DllCall("shell32.dll", "int", "DragQueryFile", "hwnd", $wParam, "int", $i, "ptr", 0, "int", 0)
        $nSize = $nSize[0] + 1
        $pFileName = DllStructCreate("char[" & $nSize & "]")
        DllCall("shell32.dll", "int", "DragQueryFile", "hwnd", $wParam, "int", $i, "ptr", DllStructGetPtr($pFileName), "int", $nSize)
        ReDim $gaDropFiles[$i+1]
        $gaDropFiles[$i] = DllStructGetData($pFileName, 1)
        $pFileName = 0
    Next
EndFunc

I see fascists...

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  

×

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.