HideMouse(1)

Just starting out? Need help? Post your questions and find answers here.
User avatar
SPH
Enthusiast
Enthusiast
Posts: 593
Joined: Tue Jan 04, 2011 6:21 pm

HideMouse(1)

Post by SPH »

Hi, :D

I would like to hide the mouse to make way for an improved arrow sprite. ChatGPT tells me that we can use HideMouse(1) but this instruction does not exist/no longer exists.
What instruction should I use (no API please because it must be Linux compatible)?

Many thanks for this insignificant problem... :shock:

!i!i!i!i!i!i!i!i!i!
!i!i!i!i!i!i!
!i!i!i!
//// Informations ////
Portable LENOVO ideapad 110-17ACL 64 bits
Version de PB : 6.12LTS - 64 bits
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4991
Joined: Sun Apr 12, 2009 6:27 am

Re: HideMouse(1)

Post by RASHAD »

Maybe you can use ReleaseMouse(State)
Egypt my love
User avatar
SPH
Enthusiast
Enthusiast
Posts: 593
Joined: Tue Jan 04, 2011 6:21 pm

Re: HideMouse(1)

Post by SPH »

Ho, thank you

It had to be put with an examinemouse() !


Thx

!i!i!i!i!i!i!i!i!i!
!i!i!i!i!i!i!
!i!i!i!
//// Informations ////
Portable LENOVO ideapad 110-17ACL 64 bits
Version de PB : 6.12LTS - 64 bits
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4991
Joined: Sun Apr 12, 2009 6:27 am

Re: HideMouse(1)

Post by RASHAD »

You are welcome :)
Egypt my love
User avatar
moulder61
Enthusiast
Enthusiast
Posts: 205
Joined: Sun Sep 19, 2021 6:16 pm
Location: U.K.

Re: HideMouse(1)

Post by moulder61 »

@SPH

I might be misunderstanding what you are trying to do, but it sounds a bit like the problem I had trying to convert Puzzle of Mystralia to work in Linux and had 2 cursors showing? The original plus your custom one.

In that case, ExamineMouse() would hide the standard cursor, but then you lost the use of the mouse. Not ideal in a mouse based game!

ReleaseMouse(#True) restores both the usage of the mouse and the standard cursor too, so you're no better off.

I found some code on the forum that solved the problem perfectly, but trimmed it down to just the necessary to get the job done.
It was from a post by Shardik. viewtopic.php?p=525626#p525626

This is what I ended up with.

Moulder.

Code: Select all

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Added code to hide cursor in Linux
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
#GDK_BLANK_CURSOR = -2

ImportC ""
  gtk_widget_get_window(*Widget.GtkWidget)
EndImport
Cursor = gdk_cursor_new_(#GDK_BLANK_CURSOR)

gdk_window_set_cursor_(gtk_widget_get_window(WindowID(win)), Cursor)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
"If it ain't broke, fix it until it is!

This message is brought to you thanks to SenselessComments.com

My PB stuff for Linux: "https://u.pcloud.link/publink/show?code ... z3MR0T3jyV
Axolotl
Addict
Addict
Posts: 872
Joined: Wed Dec 31, 2008 3:36 pm

Re: HideMouse(1)

Post by Axolotl »

Hi,
on windows you can use ShowCursor_(#False)
MSDN:

Code: Select all

int ShowCursor(
  [in] BOOL bShow
);
MSDN ShowCursor()

Sorry, I must have missed that he needs a Linux solution.
Last edited by Axolotl on Fri Sep 13, 2024 2:48 pm, edited 1 time in total.
Just because it worked doesn't mean it works.
PureBasic 6.04 (x86) and <latest stable version and current alpha/beta> (x64) on Windows 11 Home. Now started with Linux (VM: Ubuntu 22.04).
User avatar
moulder61
Enthusiast
Enthusiast
Posts: 205
Joined: Sun Sep 19, 2021 6:16 pm
Location: U.K.

Re: HideMouse(1)

Post by moulder61 »

@Axolotl

Those commands don't work on Linux, so I had to find a way around it.

SPH mentioned he wanted it compatible with Linux, but my fix probably makes it incompatible with Windows? Doh!

Moulder.
"If it ain't broke, fix it until it is!

This message is brought to you thanks to SenselessComments.com

My PB stuff for Linux: "https://u.pcloud.link/publink/show?code ... z3MR0T3jyV
Post Reply