Sign in to follow this  
Followers 0
telmob

List on hover show file path?

18 posts in this topic

I have a list (guictrlcreatelist) with some files in it, but sometimes the paths get too big and i can't see them completely in the list.

Is there any command to show the file paths like a marquee or in a tooltip?

Share this post


Link to post
Share on other sites



Use GUICtrlCreateListView() instead.

Br,

UEZ


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

This sets tip OnSel

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiListBox.au3>
#include <WinAPI.au3>

Opt('MustDeclareVars', 1)
Global $mylist
Example()

Func Example()
Local $MESSAGE = "The following buttons have been clicked"
Local $add, $clear, $close, $msg

GUICreate("My GUI list") ; will create a dialog box that when displayed is centered

$add = GUICtrlCreateButton("Add", 64, 32, 75, 25)
$clear = GUICtrlCreateButton("Clear", 64, 72, 75, 25)
$mylist = GUICtrlCreateList("buttons that have been clicked", 176, 32, 121, 97)
$close = GUICtrlCreateButton("my closing button", 64, 160, 175, 25)
GUIRegisterMsg( $WM_COMMAND, 'WM_COMMAND' )
GUISetState()

$msg = 0
While $msg <> $GUI_EVENT_CLOSE
$msg = GUIGetMsg()

Select
Case $msg = $add
GUICtrlSetData($mylist, "You clicked button No1|")
Case $msg = $clear
GUICtrlSetData($mylist, "")
Case $msg = $close
MsgBox(0, "", "the closing button has been clicked", 2)
Exit
EndSelect
WEnd
EndFunc   ;==>Example

Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam)
Local $nCode = _WinAPI_HiWord( $wParam )
Switch $nCode
Case $LBN_KILLFOCUS
GUICtrlSetTip( $mylist, '' )
Case $LBN_SELCHANGE
GUICtrlSetTip( $mylist, GUICtrlRead( $mylist ) )
EndSwitch
EndFunc


My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Use GUICtrlCreateListView() instead.

Br,

UEZ

Thanks for your reply.

Unfortunately, not what i was looking for. Its not very practical.

This sets tip OnSel

Better, but still... if i have multiple files and i click on one, even if i clicks on an empty space, the tip remains everytime i hover the list.

These examples are great, but they just don't feel natural.

Please don't think i'm ungrateful, its just that I thought this was a common/known behaviour possible in autoit, guess i was wrong... :)

Edited by telmob

Share this post


Link to post
Share on other sites

I am just trying to make a function on such calculations using _guictrllistbox_itemfrompoint

will post the results :)


My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Cool! :)

I really apreciate it.

Oh, maybe this is possible with GuiGetCursorInfo...?

Edit: WAIT!!! Found the solution here:

Edited by telmob

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Without GUIGetCursorInfo

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiListBox.au3>
#include <WinAPI.au3>

Opt('MustDeclareVars', 1)
Global $mylist, $hGUI
AdlibRegister('TimerFunc', 20)
Example()

Func Example()
Local $MESSAGE = "The following buttons have been clicked"
Local $add, $clear, $close, $msg

GUICreate("My GUI list") ; will create a dialog box that when displayed is centered

$add = GUICtrlCreateButton("Add", 64, 32, 75, 25)
$clear = GUICtrlCreateButton("Clear", 64, 72, 75, 25)
GUICtrlCreateList("buttons that have been clicked", 176, 32, 121, 97)
$mylist = GUICtrlGetHandle(-1)
$close = GUICtrlCreateButton("my closing button", 64, 160, 175, 25)
GUISetState()

$msg = 0
While $msg <> $GUI_EVENT_CLOSE
$msg = GUIGetMsg()

Select
Case $msg = $add
GUICtrlSetData($mylist, "You clicked button No1|")
Case $msg = $clear
GUICtrlSetData($mylist, "")
Case $msg = $close
MsgBox(0, "", "the closing button has been clicked", 2)
Exit
EndSelect
WEnd
EndFunc   ;==>Example

Func GetIndexofListBoxHovered($hWnd)
Local $iIndex = _GUICtrlListBox_ItemFromPoint($hWnd, _
_WinAPI_GetMousePosX(True, $hWnd), _WinAPI_GetMousePosY(True, $hWnd))
Return $iIndex
EndFunc   ;==>GetIndexofListBoxHovered

Func TimerFunc()
Local $iIndex = GetIndexofListBoxHovered($mylist)
If $iIndex < 0 Then Return ToolTip('')
ToolTip(_GUICtrlListBox_GetText($mylist, $iIndex))
EndFunc   ;==>TimerFunc
Edited by PhoenixXL

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Share this post


Link to post
Share on other sites

@PhoenixXL: nice idea!

Modified your code to avoid flickering when Tooltip is displayed:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiListBox.au3>
#include <WinAPI.au3>

Opt('MustDeclareVars', 1)
Global $mylist, $hGUI
AdlibRegister('TimerFunc', 50)
Example()

Func Example()
    Local $MESSAGE = "The following buttons have been clicked"
    Local $add, $clear, $close, $msg

    GUICreate("My GUI list") ; will create a dialog box that when displayed is centered

    $add = GUICtrlCreateButton("Add", 64, 32, 75, 25)
    $clear = GUICtrlCreateButton("Clear", 64, 72, 75, 25)
    GUICtrlCreateList("buttons that have been clicked", 176, 32, 121, 97)
    GUICtrlSetData(-1, "this is another line which is larger than the list box")
    $mylist = GUICtrlGetHandle(-1)
    $close = GUICtrlCreateButton("my closing button", 64, 160, 175, 25)
    GUISetState()

    $msg = 0
    While $msg <> $GUI_EVENT_CLOSE
        $msg = GUIGetMsg()
        Select
            Case $msg = $add
                GUICtrlSetData($mylist, "You clicked button No1|")
            Case $msg = $clear
                GUICtrlSetData($mylist, "")
            Case $msg = $close
                MsgBox(0, "", "the closing button has been clicked", 2)
                Exit
        EndSelect
    WEnd
EndFunc   ;==>Example

Func TimerFunc()
    Local Static $iMPosX_old, $iMPosY_old
    Local $iMPosX =  _WinAPI_GetMousePosX(True, $mylist), $iMPosY = _WinAPI_GetMousePosY(True, $mylist)
    Local $iIndex = _GUICtrlListBox_ItemFromPoint($mylist, $iMPosX, $iMPosY)
    If $iIndex < 0 Then Return ToolTip('')
    If $iMPosX_old <> $iMPosX Or $iMPosY_old <> $iMPosY Then
        ToolTip(_GUICtrlListBox_GetText($mylist, $iIndex))
        $iMPosX_old = $iMPosX
        $iMPosY_old = $iMPosY
    EndIf
EndFunc   ;==>TimerFunc

Br,

UEZ


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

Setting the Index number as the static variable is more efficient ( I believe )

In turn it keeps the ToolTip in one place :)

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiListBox.au3>
#include <WinAPI.au3>

Opt('MustDeclareVars', 1)
Global $mylist, $hGUI
AdlibRegister('TimerFunc', 50)
Example()

Func Example()
Local $MESSAGE = "The following buttons have been clicked"
Local $add, $clear, $close, $msg

GUICreate("My GUI list") ; will create a dialog box that when displayed is centered

$add = GUICtrlCreateButton("Add", 64, 32, 75, 25)
$clear = GUICtrlCreateButton("Clear", 64, 72, 75, 25)
GUICtrlCreateList("buttons that have been clicked", 176, 32, 121, 97)
GUICtrlSetData(-1, "this is another line which is larger than the list box")
$mylist = GUICtrlGetHandle(-1)
$close = GUICtrlCreateButton("my closing button", 64, 160, 175, 25)
GUISetState()

$msg = 0
While $msg <> $GUI_EVENT_CLOSE
$msg = GUIGetMsg()
Select
Case $msg = $add
GUICtrlSetData($mylist, "You clicked button No1|")
Case $msg = $clear
GUICtrlSetData($mylist, "")
Case $msg = $close
MsgBox(0, "", "the closing button has been clicked", 2)
Exit
EndSelect
WEnd
EndFunc ;==>Example

Func TimerFunc()
Local Static $iIndex_old = -1
Local $iIndex = _GUICtrlListBox_ItemFromPoint($mylist, _WinAPI_GetMousePosX(True, $mylist), _WinAPI_GetMousePosY(True, $mylist))
If $iIndex < 0 Then
$iIndex_old = -1
Return ToolTip('')
EndIf
If $iIndex = $iIndex_old Then Return
ToolTip(_GUICtrlListBox_GetText($mylist, $iIndex))
$iIndex_old = $iIndex
EndFunc ;==>TimerFunc
Edited by PhoenixXL

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Share this post


Link to post
Share on other sites

The disadvantage is when you move the mouse the ToolTip doesn't move.

Br,

UEZ


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

i regarded it as an advantage instead :D


My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Share this post


Link to post
Share on other sites

First of all, thank you both for your hard work.

i regarded it as an advantage instead :D

Also agree. Really nice ;)

Share this post


Link to post
Share on other sites

Updated a bit so that short strings dont create a tooltip

the calculations are still approximate..

#include <GUIConstantsEx.au3>
#include <GuiListBox.au3>
#include <WinAPI.au3>

Opt('MustDeclareVars', 1)
Global $mylist, $hGUI, $iWidth = 100
Example()

Func Example()
Local $MESSAGE = "The following buttons have been clicked"
Local $add, $clear, $close, $msg

GUICreate("My GUI list", 120, 200) ; will create a dialog box that when displayed is centered

GUICtrlCreateList("Hello", 10, 10, $iWidth, 180, 0)
GUICtrlSetData(-1, "there this is a Long String|n ds is a short 1..ZX")
$mylist = GUICtrlGetHandle(-1)
GUISetState()

Local $nMsg = GUIGetMsg()
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE, $GUI_EVENT_SECONDARYDOWN
GUIDelete()
ExitLoop
Case $GUI_EVENT_MOUSEMOVE
TimerFunc()
EndSwitch
Sleep ( 10 )
WEnd
EndFunc   ;==>Example

Func TimerFunc()
Static $iIndex_old = -1
Local $iIndex = _GUICtrlListBox_ItemFromPoint($mylist, _WinAPI_GetMousePosX(True, $mylist), _WinAPI_GetMousePosY(True, $mylist))
Local $sText = _GUICtrlListBox_GetText( $mylist, $iIndex )
Local $iLen = TextIsSmallThanList( _WinAPI_GetDC( $mylist ), $sText, $iWidth)
If $iIndex < 0 Or $iLen Then
$iIndex_old = -1
Return ToolTip('')
EndIf
If $iIndex = $iIndex_old Then Return
ToolTip( $sText )
$iIndex_old = $iIndex
EndFunc   ;==>TimerFunc

;Returns Approximate values - which causes to show ToolTip when very just close...
Func TextIsSmallThanList( $hDc, $sString, $nMaxExtent )
Local $Size_Struct = DllStructCreate( $tagSIZE )
Local $aRet = DllCall( 'Gdi32.dll', 'int', 'GetTextExtentPoint32W', _
'hwnd', $hDc, _
'str', $sString , _
'int', StringLen( $sString ), _
'ptr', DllStructGetPtr( $Size_Struct ) )
If @error Or Not $aRet[0] Then Return SetError( 1, @error, $aRet[0] )
Return DllStructGetData($Size_Struct,1) < $nMaxExtent
EndFunc

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Share this post


Link to post
Share on other sites
I am sincerely grateful for the fact that I paid attention to the issue of PhoenixXL!
Let me show you what I need, ideally!
 
It may seem even more on the Edit control but the difference is that the elements should not be changed, and when you click anywhere on the item, it should select the whole - with all its strings.
 
Can you as a specialist have any idea how to do this?

post-54057-0-69056900-1378550938_thumb.j

Share this post


Link to post
Share on other sites

AndreyS,

I would suggest using a label to hold each string and using my Scrollbars UDF to show them within the window. There are some of my previous examples of this idea on the forum if you search. :)

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

Oh! Thank you! I rush to the search! :)

Share this post


Link to post
Share on other sites

When it comes to SRE or Edit controls I can probably help.

I will soon reply you >here, for this topic has nothing to do with what you want now 

Regards :)


My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Share this post


Link to post
Share on other sites
PhoenixXL, but that's not what I need!  :huh:
I need to control the displayed items completely, and did not derive them in the tooltip.

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