Page 1 of 1

HyperLinkGadget; Mouse Cursor;

Posted: Fri Feb 05, 2016 2:45 pm
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!

Re: HyperLinkGadget; Mouse Cursor;

Posted: Fri Feb 05, 2016 3:05 pm
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)

Re: HyperLinkGadget; Mouse Cursor;

Posted: Fri Feb 05, 2016 6:14 pm
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

HyperLinkGadget; Mouse Cursor;

Posted: Fri Feb 05, 2016 8:20 pm
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!!!

Re: HyperLinkGadget; Mouse Cursor;

Posted: Sat Feb 06, 2016 12:00 pm
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!!!