"Wait" or "Working" mouse pointer icon..
"Wait" or "Working" mouse pointer icon..
Shouldn't there be a cross-platform command in the Mouse library for changing the mouse pointer icon to indicate an application is busy or working? For example, on Windows it would be nice to be able to change the pointer to an hourglass and then back to a pointer. There are functionally equivalent icons on OS X and Linux.
E.g. maybe something like this:
SetMouseIcon(#PB_MouseIcon_Wait)
and it's Get... counterpart:
Icon.l = GetMouseIcon()
Some potential #PB constants:
#PB_MouseIcon_Wait
#PB_MouseIcon_Pointer
Optionally, at a minimum maybe Set... and Get... aren't needed, maybe just MouseIcon to only Set the mouse pointer?
E.g. maybe something like this:
SetMouseIcon(#PB_MouseIcon_Wait)
and it's Get... counterpart:
Icon.l = GetMouseIcon()
Some potential #PB constants:
#PB_MouseIcon_Wait
#PB_MouseIcon_Pointer
Optionally, at a minimum maybe Set... and Get... aren't needed, maybe just MouseIcon to only Set the mouse pointer?
or so:
You can set Mouse for App and/or for Gadget (Editor for example)
Code: Select all
SetWindowMouseIcon(Window, #PB_MouseIcon_Wait)
SetGadgetMouseIcon(Gadget, #PB_MouseIcon_Wait)
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Code: Select all
SetMouseIcon(#NUM3, #PB_Hasselhoff)

PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

hehe too late, i guess he already put David in his default windows iconsts-soft wrote:Code: Select all
SetMouseIcon(#NUM3, #PB_Hasselhoff)
- netmaestro
- PureBasic Bullfrog
- Posts: 8451
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
Here you go...ts-soft wrote:SetMouseIcon(#NUM3, #PB_Hasselhoff)

Code: Select all
#NUM3 = 0
#PB_Hasselhoff = #NUM3 + 1
Procedure SetMouseIcon(img, cursor)
mycursor = CatchImage(cursor, ?mycursor)
CreateImage(img, 32, 32)
StartDrawing(ImageOutput(img))
DrawImage(mycursor, 0, 0, 32, 32)
For x = 0 To 31
For y = 0 To 31
If Point(x, y) = #Black
Plot(x, y, #White)
Else
Plot(x, y, #Black)
EndIf
Next y
Next x
StopDrawing()
icoInf.ICONINFO
icoInf\fIcon = #False
icoInf\xHotspot = 0
icoInf\yHotspot = 8
icoInf\hbmMask = ImageID(img)
icoInf\hbmColor = mycursor
newCursor = CreateIconIndirect_(icoInf)
ProcedureReturn newCursor
EndProcedure
If OpenWindow(0, 0, 0, 300, 300, "", #PB_Window_ScreenCentered | #PB_Window_SystemMenu) And CreateGadgetList(WindowID(0))
StringGadget(1, 10, 20, 280, 25, "Who's your DADDY!? click here to find out", #PB_String_ReadOnly)
newCursor = 0
Repeat
event = WindowEvent()
If EventGadget() = 1 And newCursor = 0
Restore daddy
Read daddy$
SetGadgetText(1, daddy$ + daddy$ + daddy$ + daddy$)
SetGadgetColor(1, #PB_Gadget_BackColor, RGB(0, 255, 255))
SetGadgetColor(1, #PB_Gadget_FrontColor, RGB(255, 0, 0))
;...New cursor function
newCursor = SetMouseIcon(#NUM3, #PB_Hasselhoff)
oldWinCursor = SetClassLong_(WindowID(0), #GCL_HCURSOR, newCursor)
oldGadCursor = SetClassLong_(GadgetID(1), #GCL_HCURSOR, newCursor)
EndIf
Until event = #PB_Event_CloseWindow
SetClassLong_(WindowID(0), #GCL_HCURSOR, oldWinCursor)
SetClassLong_(GadgetID(1), #GCL_HCURSOR, oldGadCursor)
DestroyIcon_(newCursor)
EndIf
End
DataSection
daddy:
Data.s $48,$41,$53,$53,$45,$4C,$48,$4F,$46,$46,$21,$21,$21,$2E,$2E,$2E,$00
mycursor:
Data.b $42,$4D,$76,$02,$00,$00,$00,$00,$00,$00,$76,$00,$00,$00,$28,$00
Data.b $00,$00,$20,$00,$00,$00,$20,$00,$00,$00,$01,$00,$04,$00,$00,$00
Data.b $00,$00,$00,$02,$00,$00,$C3,$0E,$00,$00,$C3,$0E,$00,$00,$10,$00
Data.b $00,$00,$00,$00,$00,$00,$C8,$DE,$FF,$00,$85,$BC,$FF,$00,$62,$A0
Data.b $F8,$00,$A9,$A1,$D7,$00,$4F,$97,$F6,$00,$32,$88,$F4,$00,$22,$6F
Data.b $E5,$00,$53,$5C,$E0,$00,$1D,$49,$E1,$00,$28,$44,$A9,$00,$00,$26
Data.b $D2,$00,$00,$19,$85,$00,$22,$1B,$43,$00,$00,$08,$42,$00,$00,$08
Data.b $00,$00,$00,$00,$00,$00,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$D9,$64,$24
Data.b $46,$BC,$FF,$54,$DF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$9B,$85,$21
Data.b $14,$9C,$FF,$64,$BF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$9B,$64,$20
Data.b $01,$9C,$FF,$62,$7F,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$3B,$95,$11
Data.b $11,$6D,$FF,$61,$9F,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$D9,$61
Data.b $22,$6D,$C2,$65,$BF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FD,$86,$96
Data.b $24,$5B,$F6,$26,$BF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FD,$84,$46
Data.b $22,$27,$B5,$06,$BF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$DD,$40,$11
Data.b $22,$46,$92,$06,$BF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$B9,$26,$66
Data.b $64,$24,$62,$15,$BF,$FF,$FF,$FF,$FF,$FF,$FF,$86,$B3,$77,$99,$BB
Data.b $99,$76,$52,$25,$BF,$FF,$FF,$FF,$FF,$FF,$F3,$A5,$5B,$99,$B6,$69
Data.b $99,$BB,$42,$65,$BF,$FF,$FF,$FF,$FF,$FF,$F5,$89,$19,$96,$97,$11
Data.b $46,$9D,$44,$6A,$BF,$FF,$FF,$FF,$FF,$FF,$F6,$8B,$17,$74,$99,$71
Data.b $12,$59,$55,$69,$BF,$FF,$FF,$FF,$FF,$FF,$F6,$AD,$45,$96,$69,$72
Data.b $11,$12,$25,$69,$CF,$FF,$FF,$FF,$FF,$FF,$F6,$BC,$02,$96,$78,$72
Data.b $12,$11,$14,$6B,$FF,$FF,$FF,$FF,$FF,$FF,$F6,$D3,$F0,$78,$86,$23
Data.b $12,$21,$02,$8B,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$F0,$FF,$33,$97,$72
Data.b $26,$54,$12,$9F,$FF,$FF,$FF,$FF,$FF,$FF,$F4,$B0,$FF,$F7,$96,$44
Data.b $66,$58,$67,$3F,$FF,$FF,$FF,$FF,$FF,$FF,$F1,$19,$FF,$F0,$A8,$85
Data.b $24,$56,$7F,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$F8,$42,$BC,$DF,$7A,$B9
Data.b $B9,$22,$0F,$FF,$FF,$FF,$FF,$FF,$F3,$9A,$A7,$22,$77,$DD,$34,$BD
Data.b $DD,$77,$D0,$FF,$FF,$FF,$FF,$F3,$AA,$AA,$A9,$77,$33,$DD,$01,$24
Data.b $DD,$CB,$3B,$FF,$FF,$FF,$F3,$7A,$AA,$AA,$AA,$AA,$AB,$DD,$54,$79
Data.b $9C,$B7,$0B,$3F,$FF,$FF,$AA,$8A,$54,$55,$8A,$AA,$AA,$DE,$21,$94
Data.b $99,$B7,$09,$9F,$FF,$FF,$AA,$88,$41,$12,$56,$86,$58,$D9,$00,$21
Data.b $93,$B7,$0B,$7F,$FF,$FF,$FF,$07,$87,$77,$77,$74,$27,$DC,$95,$99
Data.b $7C,$B8,$0B,$FF,$FF,$FF,$FF,$FF,$03,$23,$37,$00,$00,$FC,$10,$17
Data.b $9D,$BA,$B3,$FF,$FF,$FF,$FF,$FF,$FF,$F3,$7A,$AA,$AA,$FD,$40,$01
Data.b $DD,$D7,$0F,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$F9,$4B
Data.b $DD,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$DD,$DF
Data.b $DF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$DF
Data.b $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
Data.b $FF,$FF,$FF,$FF,$FF,$FF
EndDataSection
What goes around comes around.
PB 5.21 LTS (x86) - Windows 8.1
PB 5.21 LTS (x86) - Windows 8.1









sparkie has the trophy today!
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
( The path to enlightenment and the PureBasic Survival Guide right here... )

PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
