Jump to content
Sign in to follow this  
ZwinnyRolnik

Two questions about the menu and scroll

Recommended Posts

ZwinnyRolnik

1) How can I open / show on the top menu or menu item without pressing mouse button on it? Function: _GUICtrlMenu or GuiCtrlCreatemenu.

2) In my listview scrolling is very slow because it is registered GUIRegisterMsg($WM_MOVING,"WM_Notify_Events").

I tried to get around this way:

Func WM_Notify_Events($hWndGUI, $MsgID, $wParam, $lParam)
    #forceref $hWndGUI, $MsgID, $wParam
    
    
    Local $tagNMHDR, $pressed,$event, $retval = $GUI_RUNDEFMSG ;, $idFrom
    $tagNMHDR = DllStructCreate("int;int;int", $lParam);NMHDR (hwndFrom, idFrom, code)
    If @error Then
        $tagNMHDR =0
        Return
    EndIf
    
;~  $from = DllStructGetData($tagNMHDR, 1)
;~  $idFrom = DllStructGetData($tagNMHDR,2)
    ;ConsoleWrite("idFrom="&$idFrom&@LF)
    $event = DllStructGetData($tagNMHDR, 3)
Select
    Case $wParam = $__LISTVIEWCTRL
        Select
            Case $event=$LVN_BEGINSCROLL
                        $bWM_NOTIFY = False
                    WinSetTitle($gui,"","on")
    
                        Case $event=$LVN_ENDSCROLL
                        $bWM_NOTIFY = True
                    
            WinSetTitle($gui,"","off")
           EndSelect
EndSelect
            
    
    
    
       If $bWM_NOTIFY Then
; other select/case/functions

but this works on the principle:

a) left click on scroll

:blink: $bWM_NOTIFY = False

c) 0,1s later is "$bWM_NOTIFY = True" but i do not let the button

how to make $bWM_NOTIFY = False whenever i click on the scrollbar and i still hold the button?

there is example:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Include <GuiListView.au3>
#include <Constants.au3>
#include <FontConstants.au3>
#include <StructureConstants.au3>
Global $bWM_NOTIFY = True

$gui = GUICreate("TEST", 500, 300) 

$filemenu = GuiCtrlCreatemenu ("File")
$fileitem = GuiCtrlCreateMenuitem ("Open...",$filemenu)
$recentfilesmenu = GuiCtrlCreatemenu ("Recent Files",$filemenu)

$separator1 = GuiCtrlCreateMenuitem ("",$filemenu)
$exititem = GuiCtrlCreateMenuitem ("Exit",$filemenu)
$helpmenu = GuiCtrlCreatemenu ("?")
$aboutitem = GuiCtrlCreateMenuitem ("About",$helpmenu)


Global $ListView = GUICtrlCreateListView("", 25,25,450,200)
    $__LISTVIEWCTRL = $ListView
For $i = 0 To 30
    if $i = 0 Then
        _GUICtrlListView_AddColumn($ListView, "start", "",2)
        _GUICtrlListView_SetColumnWidth($ListView, $i, 50)
        ContinueLoop
    EndIf
    _GUICtrlListView_AddColumn($ListView, "column"&$i, "",2)
    _GUICtrlListView_SetColumnWidth($ListView, $i, 100)
Next
    
    ; kolory
    _GUICtrlListView_SetBkColor($ListView, $CLR_MONEYGREEN)
    _GUICtrlListView_SetTextColor($ListView, $CLR_BLACK)
    _GUICtrlListView_SetTextBkColor($ListView, $CLR_MONEYGREEN)
    
For $i = 1 To 30
    
     _GUICtrlListView_AddItem($ListView, "item: "&$i)
Next
For $i = 1 To 50
    
    For $j = 1 To 30
        
    _GUICtrlListView_AddSubItem($ListView, $i - 1, "subitem("&$i&","&$j&")", $j)

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

While 1
   $msg = GuiGetMsg()
   Select 
   Case $msg = $GUI_EVENT_CLOSE 
      ExitLoop 

   EndSelect 
WEnd


Func WM_Notify_Events($hWndGUI, $MsgID, $wParam, $lParam)
    #forceref $hWndGUI, $MsgID, $wParam
    
    Global $iLastItem = -1, $iLastsubitemNR = -1
    Global $hGUI_Multiline, $View_Multiline, $ColName ; Multiline cell viewer window
    
    
    Local $tagNMHDR, $pressed,$event, $retval = $GUI_RUNDEFMSG ;, $idFrom
    $tagNMHDR = DllStructCreate("int;int;int", $lParam);NMHDR (hwndFrom, idFrom, code)
    If @error Then
        $tagNMHDR =0
        Return
    EndIf
    
;~  $from = DllStructGetData($tagNMHDR, 1)
;~  $idFrom = DllStructGetData($tagNMHDR,2)
    ;ConsoleWrite("idFrom="&$idFrom&@LF)
    $event = DllStructGetData($tagNMHDR, 3)
    Select
        Case $wParam = $__LISTVIEWCTRL
            Select
                Case $event=$LVN_BEGINSCROLL
                    $bWM_NOTIFY = False
                    ToolTip("")
                    WinSetTitle($gui,"","TEST: clicked")
    
                Case $event=$LVN_ENDSCROLL
                    $bWM_NOTIFY = True
                    WinSetTitle($gui,"","TEST: not")
            EndSelect
    EndSelect
            
    
    
    
If $bWM_NOTIFY Then
           
    Select
    
        Case $wParam = $__LISTVIEWCTRL
            Select
                
                Case $event = $NM_CLICK
                    
                ;etc
            EndSelect
    EndSelect
EndIf
    
    $tagNMHDR = 0
    $event = 0
    $lParam = 0
    Return $retval
EndFunc   ;==>WM_Notify_Events

Please help and suggestions, sorry for poor English. Zwinny

Share this post


Link to post
Share on other sites
ZwinnyRolnik

When I click the menuitem I do not want to hid. Possible with this function from the link? And anyone who knows anything about nr 2)

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.