HyperLinkGadget; Mouse Cursor;

Windows specific forum
HanPBF
Enthusiast
Enthusiast
Posts: 570
Joined: Fri Feb 19, 2010 3:42 am

HyperLinkGadget; Mouse Cursor;

Post by HanPBF »

Hello,

somewhat stange; even searching for that problem and having found some solution, none did work.

Does someone has a simple example to keep the mouse cursor on a hyperlink gadget an arrow?
No matter if in event-loop or callback.

I found some examples; but maybe they are too old and don't work anymore.

Any help apreciated!
Thanks a lot!
User avatar
RSBasic
Moderator
Moderator
Posts: 1228
Joined: Thu Dec 31, 2009 11:05 pm
Location: Gernsbach (Germany)
Contact:

Re: HyperLinkGadget; Mouse Cursor;

Post by RSBasic »

Code: Select all

EnableExplicit

Global HyperLinkProc
Global hCurcor_Arrow = LoadCursor_(0, #IDC_ARROW)

Procedure HyperLinkProc(hWnd, uMsg, wParam, lParam)
  Select uMsg
    Case #WM_SETCURSOR
      SetCursor_(hCurcor_Arrow)
      ProcedureReturn 1
  EndSelect
  
  ProcedureReturn CallWindowProc_(HyperLinkProc, hWnd, uMsg, wParam, lParam)
EndProcedure

If OpenWindow(0, 0, 0, 500, 250, "Window", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  HyperLinkGadget(1, 10, 10, 480, 20, "http://www.purebasic.de - without hand cursor", 0)
  HyperLinkGadget(2, 10, 30, 480, 20, "http://www.google.de - with hand cursor", 0)
  
  HyperLinkProc = SetWindowLongPtr_(GadgetID(1), #GWL_WNDPROC, @HyperLinkProc())
  
  Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
(only windows)
Image
Image
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4997
Joined: Sun Apr 12, 2009 6:27 am

Re: HyperLinkGadget; Mouse Cursor;

Post by RASHAD »

One more tech.(Windows only)

Code: Select all

CrossCur  = LoadCursor_(0, #IDC_CROSS)
HelpCur  = LoadCursor_(0, #IDC_HELP)

OpenWindow(0, 0, 0, 500, 250, "Window", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  HyperLinkGadget(0, 10, 10, 480, 20, "http://www.purebasic.de - without hand cursor", 0)
  HyperLinkGadget(1, 10, 30, 480, 20, "http://www.google.de - with hand cursor", 0)

Repeat
  Select WaitWindowEvent()
    Case #PB_Event_CloseWindow 
      Quit=1 
  
  Case #WM_MOUSEMOVE  
    Select ChildWindowFromPoint_(WindowID(0),WindowMouseY(0) << 32 + WindowMouseX(0)) 
      Case GadgetID(0)
        SetClassLongPtr_(GadgetID(0), #GCL_HCURSOR, 0)
        SetCursor_(CrossCur)
        
      Case GadgetID(1)
        SetClassLongPtr_(GadgetID(1), #GCL_HCURSOR, 0)
        SetCursor_(HelpCur)
    EndSelect 
  EndSelect 
Until Quit=1
Egypt my love
HanPBF
Enthusiast
Enthusiast
Posts: 570
Joined: Fri Feb 19, 2010 3:42 am

HyperLinkGadget; Mouse Cursor;

Post by HanPBF »

Hello RASHAD,
thanks a lot!

I forgot the loadCursor... damned... friday...

Better put some code example the next time in my code, so the error is obviously seen.

Thanks again, indeed.
Always apreciate Your help!!!
HanPBF
Enthusiast
Enthusiast
Posts: 570
Joined: Fri Feb 19, 2010 3:42 am

Re: HyperLinkGadget; Mouse Cursor;

Post by HanPBF »

The friday problem did let me also forget a really good help...

Here it is: http://www.rsbasic.de/winapi-library/

Thanks again,
RASHAD and RSBasic!!!
Post Reply