It is currently Wed Jan 27, 2021 7:55 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: SetWindowColor() Using PB 572 x64 on Ubuntu 18.04 x64
PostPosted: Tue Jun 30, 2020 12:07 pm 
Offline
User
User

Joined: Thu Aug 30, 2018 11:34 am
Posts: 32
Hi

SetWindowColor() doesn't appear to be working.
Window background colour is always white regardless of RGB() value.

Code:
 OpenWindow(0, 0, 0, 800, 600, "")
 OpenWindowedScreen(WindowID(0), 100, 100, 600, 400, 0, 0, 0)
 SetWindowColor(0, RGB(255,0,0))





Are the errors displayed by ./launch.sh (see below) going to cause problems?

Code:
jah@ubuntu:~/purebasic$ ls -l *.sh
-rwxr-xr-x 1 jah jah 2202 Mar 30 20:08 checkinstall.sh
-rwxr-xr-x 1 jah jah   21 Mar 30 20:08 launch.sh
-rwxr-xr-x 1 jah jah 1807 Mar 30 20:08 register.sh


jah@ubuntu:~/purebasic$ ./register.sh
File extensions .pb, .pbi, .pbf are now registered for PureBasic.


jah@ubuntu:~/purebasic$ ./checkinstall.sh
This script try to detect if all developments packages are correctly installed.
<snip>
Everything seems correctly setup for PureBasic !


jah@ubuntu:~/purebasic$ ./launch.sh
Gtk-Message: 10:16:49.617: Failed to load module "canberra-gtk-module"

** (purebasic:4481): CRITICAL **: 10:16:49.830: murrine_style_draw_box_gap: assertion 'height >= -1' failed

** (purebasic:4481): CRITICAL **: 10:16:49.904: murrine_style_draw_box_gap: assertion 'height >= -1' failed


Top
 Profile  
Reply with quote  
 Post subject: Re: SetWindowColor() Using PB 572 x64 on Ubuntu 18.04 x64
PostPosted: Tue Jun 30, 2020 5:37 pm 
Offline
Addict
Addict
User avatar

Joined: Thu Apr 21, 2005 2:38 pm
Posts: 1791
Location: Germany
You should always post code which you have tested. Your posted example doesn't work because you don't use InitSprite() at the beginning (an error message is displayed which gives you that hint) and your code doesn't have any event loop so the program ends at once. In order to answer your question I first had to do this for you:
Code:
InitSprite()
OpenWindow(0, 0, 0, 800, 600, "")
OpenWindowedScreen(WindowID(0), 100, 100, 600, 400, 0, 0, 0)
SetWindowColor(0, RGB(255,0,0))

Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow

To set the window background color you have two options:
1. Set the subsystem to Gtk2 (Menu > Compiler > Compiler Options... > Library Subsystem: gtk2)
2. When using the default Gtk3, trying to use SetWindowColor() will most likely fail in most Linux distributions. This is not PureBasic's fault but that of Gtk3. During the development of Gtk3 at least 3 times the required methods to change the background color have been modified so being a moving target for PureBasic. But you may try this workaround which was tested successfully on 16 different Linux versions with different Gtk3 versions.


Top
 Profile  
Reply with quote  
 Post subject: Re: SetWindowColor() Using PB 572 x64 on Ubuntu 18.04 x64
PostPosted: Wed Jul 01, 2020 10:30 am 
Offline
User
User

Joined: Thu Aug 30, 2018 11:34 am
Posts: 32
Thank you Shardik. Sorry code was incomplete but I presumed this would be a known issue.

Both of the SetWindowBackColor() examples work as does (Menu > Compiler > Compiler Options... > Library Subsystem: gtk2)


Top
 Profile  
Reply with quote  
 Post subject: Re: SetWindowColor() Using PB 572 x64 on Ubuntu 18.04 x64
PostPosted: Wed Jul 01, 2020 6:23 pm 
Offline
Addict
Addict
User avatar

Joined: Fri May 12, 2006 6:51 pm
Posts: 2820
Location: Germany
Workaround for GTK3

Link: viewtopic.php?f=15&t=71992

_________________
My Projects ThreadToGUI / OOP-BaseClass / OOP-BaseClassDispatch / EventDesigner V3
PB v3.30 / v5.70 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye