Border problems
Posted
#1
(In Topic #596)
Regular

There has been written a lot on this forum on setting or customizing control borders, but it’s all about the GridView control.
I just have taken up programming again – new computer Gambas 3.14.3 installed, and something feels wrong.
Whichever control I want to set a border for, it only results in something thin faint greyish. Whether I choose Plain, Sunken, Raised or Etched, it all looks the same.
Is this a bug?
But what’s more important for my project : is it at all possible to assign some ‘style’ to Gambas controls other than GridView? Such as width or thickness or colour…
Old african saying:
You eat an elephant one small bite at a time.
You eat an elephant one small bite at a time.
Posted
Guru

Posted
Guru

Doctor Watson said
Hi.
There has been written a lot on this forum on setting or customizing control borders, but it’s all about the GridView control.
I just have taken up programming again – new computer Gambas 3.14.3 installed, and something feels wrong.
Whichever control I want to set a border for, it only results in something thin faint greyish. Whether I choose Plain, Sunken, Raised or Etched, it all looks the same.
Is this a bug?
But what’s more important for my project : is it at all possible to assign some ‘style’ to Gambas controls other than GridView? Such as width or thickness or colour…
you could apply some tricks to add more borders like placing your object inside a panel , maybe even 2 panels for thickness and give the panels borders.
gambas mostly uses the gui interfaces to make it's controls, so borders and styles will be set by that.
To be honest i've not seen much difference in border styles either.
but the above trick of using bordered panels can help.
As for colours most controls have a background and foreground colour setting.
Keep your eyes peeled on the object properties panel and the auto-complete popup menu , , lots of details there
BruceS
Posted
Regular

Bruce : I’ve tried that ‘trick’ already, but it makes building a GUI rather complicated. It would just be nice if there are ways to define control borders using more options than the 4 provided. Also provided those work in the first place – unless I’m doing something wrong.
Cogier : I will build post one or more screenshots ASAP.
Greetings
Old african saying:
You eat an elephant one small bite at a time.
You eat an elephant one small bite at a time.
Posted
Guru

Doctor Watson said
Hi Cogier and Bruce
Bruce : I’ve tried that ‘trick’ already, but it makes building a GUI rather complicated. It would just be nice if there are ways to define control borders using more options than the 4 provided. Also provided those work in the first place – unless I’m doing something wrong.
Cogier : I will build post one or more screenshots ASAP.
Greetings
Yes but like we both said Doc….
the controls are mostly gtk or qt controls ,
gtk and qt do not offer that level of border customisation so neither can gambas.
if you really want it , you gotta try to implement it yourself either with a panel trick or building a custom control
And watch out for the fact for some Controls .Border can be Border.Raised, Border.Etched, etc while for some other controls.Border is just True or False.
Bruce
Posted
Regular

I hope this will shed a light on what’s going wrong.
Steps :
- created a Form ‘TestBorders’
- placed 4 Label controls on it
- Using the Properties Panel, chose a Border for each of them
That’s all. There is no code whatsoever in TestBorders.class
The screenshots speak for themselves.
Please look at what happens on the TestBorders form when Border has been set to Etched.
Perhaps this hasn’t anything to do with the problem : screen resolution is 1920x1080 (16:9)
Old african saying:
You eat an elephant one small bite at a time.
You eat an elephant one small bite at a time.
Posted
Regular

Doctor Watson said
…I hope this will shed a light on what’s going wrong….
We hear what you are saying Doc, but you need to follow through your test to the next stage.
The one thing that is rubbish about my Distro (Peppermint 10) is bloody "Themes", and I suspect the Themes on your OS are not much better.
What Charlie & Bruce are saying is that the look of your borders is completely controlled by the Theme in use.
Here are my results from changing themes with the same Gambas Form and Labels;
I started compiling a spreadsheet some time ago (until I got bored with it) in the hope that I could find a Theme on Peppermint that works well. With some themes you cant even read all text because it displays black-on-black!
Posted
Regular

Doctor Watson said
…Bruce : I’ve tried that ‘trick’ already, but it makes building a GUI rather complicated….
Adding your own borders will add some complexity, but you can still write tidy & compact code if you avoid just adding code in-line.
This simple routine could be used for any number of labels & panels…or any other controls;
Code (gambas)
- BorderMe(Label1, panel1, Color.DarkGray)
- BorderMe(Label4, panel2, Color.Red)
- With thisControl
- .Background = Color.LightBackground
- thisPanel.top = .Top - 1
- thisPanel.Width = .Width + 4
- thisPanel.Height = .Height + 4
- thisPanel.Background = shadowColour
- thisPanel.Lower()
Posted
Regular

But it doesn’t solve the problem regarding the border styles. Meanwhile I found that 3 more styles should be possible: Dashed, Dotted and Double.
And that brings me to the Themes. I have never used any, just satisfied with the ‘default’ one gets when installing Ubuntu, whatever it’s called.
I’m rather surprised to see that one would have to install a particular Ubuntu theme for Gambas controls to work / show properly.
That must have consequences for program developers.
Suppose I did install a theme such as Raleigh – where the borders show as they should – and I write this project I’m working on. When I run it, all looks like it should. Then I compile it into an executable and distribute it. But only users who have installed a compatible Theme would see it as it should …..
This looks like a clear bug to me. If my reasoning is right, it could even be that the Gambas developers were using such a Theme at the time they wrote the code.
I’m still hoping for a solution. It’s the Raised Border style I’m looking for in particular.
I wrote my program some years ago in RealBasic and it’s GUI just looked fine. If I have to settle for a meagre trick to produce something that looks like a border … it’s just feels not right, doesn't it?
Old african saying:
You eat an elephant one small bite at a time.
You eat an elephant one small bite at a time.
Posted
Regular

Doctor Watson said
…I have never used any [themes], just satisfied with the ‘default’ one gets when installing Ubuntu, whatever it’s called.
I’m rather surprised to see that one would have to install a particular Ubuntu theme for Gambas controls to work / show properly.
…But only users who have installed a compatible Theme would see it as it should …..
…This looks like a clear bug to me…
… it’s just feels not right, doesn't it?
What we call "Linux" is really just the core of the operating system. This core has been used in "distributions" like Debian, Red Hat & so on to create a usable graphical computer system. Each distribution is built with a number of sub-systems, one of which is the Window Manager which presents/displays windows and usually allows a lot of flexibility in terms of font sizes, colours, icons, mouse pointers & so on.
The selection of icons used are generally grouped in a icon theme set. There are also system themes which interpret and display controls like labels and text boxes. On my Peppermint system there are 43 listed themes and I suspect there are a similar number on Ubuntu, as there must be hundreds in circulation.
The Gambas devs don't write controls based upon a particular system theme and its not a Gambas bug. Its the theme writers that determine how they want to display components. Take a look at my post with the Rayleigh theme and you will notice that although the label borders look correct, the textbox doesn't have a border or even a white background. There isn't a Gambas theme (unfortunately) and none of the 43 themes on my system 'work properly' because each one appears to mis-interpret some aspect of one or more controls (…if I can put it that way).
To make matters worse, users can also change system colours, which may affect how your carefully designed Gambas Form looks when it is displayed.
I have just expanded my example:-
Code (gambas)
- BorderMe(Label5, panel1, Color.DarkGray, SUNKEN_BORDER)
- BorderMe(Label6, panel2, Color.Black, RAISED_BORDER)
- BorderMe(textbox6, panel3, Color.DarkBlue, SUNKEN_BORDER)
- BorderMe(Button4, panel4, Color.Red, RAISED_BORDER)
- Case RAISED_BORDER
- iOffsetTL = 1
- iOffsetWH = 4
- Case SUNKEN_BORDER
- iOffsetTL = 4
- iOffsetWH = 5
- iOffsetTL = 0
- iOffsetWH = 0
- With thisControl
- .Background = Color.Background
- thisPanel.top = .Top - iOffsetTL
- thisPanel.Width = .Width + iOffsetWH
- thisPanel.Height = .Height + iOffsetWH
- thisPanel.Background = shadowColour
- thisPanel.Lower()
Which give controls that look like this (on my system);
But its probably pointless using code like this if you want to distribute your code to other users, because you still cant be sure how it will look on other peoples systems.
Yes, its a bit of a mess.
Posted
Guru

Doctor Watson said
Indeed Steve. This code should simplify something I tried with a lot more coding.
But it doesn’t solve the problem regarding the border styles. Meanwhile I found that 3 more styles should be possible: Dashed, Dotted and Double.
And that brings me to the Themes. I have never used any, just satisfied with the ‘default’ one gets when installing Ubuntu, whatever it’s called.
I’m rather surprised to see that one would have to install a particular Ubuntu theme for Gambas controls to work / show properly.
That must have consequences for program developers.
Suppose I did install a theme such as Raleigh – where the borders show as they should – and I write this project I’m working on. When I run it, all looks like it should. Then I compile it into an executable and distribute it. But only users who have installed a compatible Theme would see it as it should …..
This looks like a clear bug to me. If my reasoning is right, it could even be that the Gambas developers were using such a Theme at the time they wrote the code.
I’m still hoping for a solution. It’s the Raised Border style I’m looking for in particular.
I wrote my program some years ago in RealBasic and it’s GUI just looked fine. If I have to settle for a meagre trick to produce something that looks like a border … it’s just feels not right, doesn't it?
What's clear is you are either new to linux and writing linux software and you do not really understand how it all works..
Some use different themes , some systems use QT only and not GTK, some GTK not QT
You say you do not use a theme , again this shows your knowledge of linux itself.
That's how linux works , just because you do not know you are using one does not mean you are not.
It's not a theme that just applies pictures. it controls many aspects of your desktop.
your reasoning actually, is not right at all. Sorry to say it.
you can use the utilities available and methods to make a GUI or not , if you want something special you have to code it.
I guess the basic app you wrote years ago was on a different linux, probably has a better theme installed.
I have complained and reported bugs about many gambas things on the gambas developers mailing lists and many were just my lack of knowledge about how the linux system works. (fair enough, i was happy be be informed the truth)
which brings me on to bugs..
This is not the gambas developers mailing list it is a support/gambas users forum.
The only person here that's written any code that's a part of gambas is me (as far as i i am aware) and I'm not part of the gambas team either i'm just a supporter. So this is not the place to report bugs, this is a place to get advice and help.
We can help you with your gambas programming code and help with things you do not understand about linux,
And let you know of the "tricks" and workarounds there are if you want something specific that gambas (and linux) do not do in general.
I hope that makes sense, sorry if it's not the answer you were looking for.
All the best
BruceS
Posted
Regular

I usually close the Console at the bottom of Gambas but this time I forgot. When running my sample project, I spotted this :
If not, thanks for your example. I do want to learn this programming technique – still an amateur you know .
Unfortunately there seems to be something missing. When I try to run it, execution stops at 'Select Case iStyle' and gives an error : Unknown identifier : iStyle
Missing DIM ?
Old african saying:
You eat an elephant one small bite at a time.
You eat an elephant one small bite at a time.
Posted
Regular

Doctor Watson said
Could this be the reason why the borders don’t show as expected?
I usually close the Console at the bottom of Gambas but this time I forgot. When running my sample project, I spotted this :
Gtk-Message.png
Could that be the reason why the borders don’t show as expected?
If not, thanks for your example. I do want to learn this programming technique – still an amateur you know .
Unfortunately there seems to be something missing. When I try to run it, execution stops at 'Select Case iStyle' and gives an error : Unknown identifier : iStyle
Missing DIM ?
iStyle is declared in the Public Function line as the last item; iStyle As Integer)
so please recheck your code.
As for the error message, check to see if libcanberra-gtk-module is installed via Synaptic or whatever you use to install software.
But this probably won't fix the borders. If you open your file manager and look at how the controls appear, then change your desktop Theme, you will see that the controls change. Which proves its not a Gambas thing, but that Themes affect other programs too.
Posted
Guru

Doctor Watson said
Could this be the reason why the borders don’t show as expected?
I usually close the Console at the bottom of Gambas but this time I forgot. When running my sample project, I spotted this :
Gtk-Message.png
Could that be the reason why the borders don’t show as expected?
If not, thanks for your example. I do want to learn this programming technique – still an amateur you know .
Unfortunately there seems to be something missing. When I try to run it, execution stops at 'Select Case iStyle' and gives an error : Unknown identifier : iStyle
Missing DIM ?
Missing or not defined in a Public space.
where do you define the iStyle variable in your source?
[EDIT] (sorry i missed that bit
Public Function BorderMe(thisControl As Control, thisPanel As Control, shadowColour As Integer, iStyle As Integer)
you must have not copy-n-pasted all of the line.
Those warning messages are coming from GTK not gambas but though your gambas app.
sometimes they are just unstoppable and they are harmless warnings, I would not pay them much attention.
although they can be clues to make your app work better sometimes.
BruceS
Posted
Guru

On the "Theme" page there is a button "Customize"
If you press that you can select different widget themes for Window and controls, etc.
THAT is how you get borders to show correctly.
Gambas cannot do it, gambas just makes use of either the GTK or QT controls (or widgets)
If you app ABSOLUTELY MUST have the borders as you want them you either have to make it yourself or advise the user in your readme of the widget themes to use for the best experience.
Some of the themes and controls are just not as well made as the others. (yes even the ones some linux systems use as defaults)
Live and learn though eh fella
It's not an ideal world but for free gambas is for sure one of the best and easiest IDE's to get your head around
slow steps though innit , don't run before you can walk as my mother used to say
And be happy with what you have got more than unhappy with all you've not got as there is more that you have not got than you have.
It's just a matter of focus.
(i just made that up)
BruceS
Posted
Regular

Steve : thanks for the update.
Bruce, you made me almost make dance for joy when I read
THAT is how you get borders to show correctly.
However ….
Go to your system settings and open the "Appearance" settings from "Look/Feel"
On the "Theme" page there is a button "Customize"
If you press that you can select different widget themes for Window and controls, etc.
I am running Ubuntu 20.04.2 LTS and there is no ‘Look/Feel’ option but ‘Appearance’ is.
When you open Appearance you get :
Back to square 1.
I just found this about Gnome Tweaks : Change Desktop Theme on Ubuntu.
Would / could that do the trick?
I’ve not installed it yet, but I have call it a day for now – other duties await.
Have a nice weekend
Old african saying:
You eat an elephant one small bite at a time.
You eat an elephant one small bite at a time.
Posted
Guru

.
Not sure how to do it on the less configurable desktops as i never use them.
what i use is part of mate-control-center
maybe install that?
Posted
Regular

I'm going to play around with the default themes, search for some new appropriate ones and see what their effect is with Borders.
There are already two that could qualify : HighContrast and HighContrastInverse. Raised borders for intance appear as they should
But I am also thinking of an additional possibility if it can be done at all, but that must be a topic for another post.
I’ll be back ASAP
Cheers!
Old african saying:
You eat an elephant one small bite at a time.
You eat an elephant one small bite at a time.
1 guest and 0 members have just viewed this.










