Close popmenu hitself [Resolved]

Just starting out? Need help? Post your questions and find answers here.
superadnim
Enthusiast
Enthusiast
Posts: 480
Joined: Thu Jul 27, 2006 4:06 am

Post by superadnim »

If it gives you money, can you wire-transfer a bit? :lol:
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

superadnim wrote:You know, you can tell Windows to hide the cursor when typing ;)
Clicking to show the menu would show the cursor again, right?
superadnim
Enthusiast
Enthusiast
Posts: 480
Joined: Thu Jul 27, 2006 4:06 am

Post by superadnim »

And how can you type while displaying a menu and partially occluding the text you are reading / writing?, what Im saying goes for editing not for viewing since you don't escape from the menu while you read, but you do when you type.

Its worth mentioning... I never encountered that situation because I've no need to leave a menu open while I'm reading something, I'm also smart enough not to open the menu on top of the text if I can... and if not, I still use the menu. ie I don't leave it waiting, after all... pop-up menus exist just to cut down on the time it takes you to access certain vital functions of an application.
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Re:

Post by PB »

Fixed Fluid Byte's code to work with v5.21 LTS:

Code: Select all

Procedure WindowCallback(hWnd,uMsg,wParam,lParam)
  Select uMsg
    Case #WM_ENTERIDLE
      GetCursorPos_(cpt.POINT)
      ;If WindowFromPoint_(cpt\x,cpt\y) = hwnd
      If WindowFromPoint_(PeekQ(cpt))=hwnd
        EndMenu_()
      EndIf
  EndSelect
  ProcedureReturn #PB_ProcessPureBasicEvents
EndProcedure

CreatePopupMenu(0)

MenuItem(1,"Cut")
MenuItem(2,"Copy")
MenuItem(3,"Paste")
MenuBar()
OpenSubMenu("Options")
MenuItem(4,"Window...")
MenuItem(5,"Gadget...")
CloseSubMenu()
MenuBar()
MenuItem(6,"Quit")

OpenWindow(0,0,0,320,240,"Right-click!",#PB_Window_SystemMenu|#PB_Window_ScreenCentered)

SetWindowCallback(@WindowCallback())

Repeat
  EventID = WaitWindowEvent()
  If EventID = #WM_RBUTTONDOWN
    DisplayPopupMenu(0,WindowID(0))
  EndIf
Until EventID = #PB_Event_CloseWindow
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5502
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: Close popmenu hitself [Resolved]

Post by Kwai chang caine »

Thanks :wink:
ImageThe happiness is a road...
Not a destination
Post Reply