Hello, I am new to Gambas.. recently switched to Linux and trying to switch to some native platform for coding. Please assist a little. Thank you!
1. Which controls allow multi-column display of data (listbox / listview)?
2. How to make spinbox to accept decimal places?
3. How to configure valuebox to accept / not-accept decimal places?
4. How to set fixed (0, 2 or 3) decimal places in those controls?
5. Which database systems are supported?
New to Gambas.. seek some help
- BruceSteers
- Posts: 1608
- Joined: Thursday 23rd July 2020 5:20pm
- Location: Isle of Wight
- Contact:
Re: New to Gambas.. seek some help
1. Probably GridView is what you want.Mudassir wrote: ↑Monday 5th February 2024 11:18pm Hello, I am new to Gambas.. recently switched to Linux and trying to switch to some native platform for coding. Please assist a little. Thank you!
1. Which controls allow multi-column display of data (listbox / listview)?
2. How to make spinbox to accept decimal places?
3. How to configure valuebox to accept / not-accept decimal places?
4. How to set fixed (0, 2 or 3) decimal places in those controls?
5. Which database systems are supported?
https://gambaswiki.org/wiki/comp/gb.qt4/gridview
2. you cannot , spinbox is integer not float.
https://gambaswiki.org/wiki/comp/gb.qt4/spinbox
3. With valuebox set it's Type property to the format you want then setting the Value property should be automatic displayed.
https://gambaswiki.org/wiki/comp/gb.form/valuebox
4. no idea
5. gb.db info is specified here https://gambaswiki.org/wiki/comp/gb.db
Please have a good read of the gambas wiki https://gambaswiki.org/wiki
Most of the questions you have asked (except maybe number 4) have answers there in much more detail.
If at first you don't succeed , try doing something differently.
BruceS
BruceS
Re: New to Gambas.. seek some help
The "usual" way to set the number of decimal points displayed in a control, whether it's a numeric or textual control is to use the Round() function when setting the value. This wont work for controls that only display or handle integers of course.
The "usual" way of doing a decimal spinbox is to multiply the value by 10^number of decimal points. This is a visual pain for the user but it's the best I could ever come up with.
b
The "usual" way of doing a decimal spinbox is to multiply the value by 10^number of decimal points. This is a visual pain for the user but it's the best I could ever come up with.
b
Have you ever noticed that software is never advertised using the adjective "spreadable".
Re: New to Gambas.. seek some help
re database support. Gambas supports quite a lot of database handling (and it is incredibly fast) but the fully integrated database features are not (ahem) sophisticated. If you want to use more advanced SQL techniques almost anything can be done but you have to "do it yourself". For example, there is no direct way to call a postgres function you need to do an Exec call to the database. (I have no idea whether it could work for other database drivers as I wont touch MySql/MariaDB with a bargepole. Not because the Gambas interface doesn't work, just that MySQL and to a certain degree MariaDB doesn't bloody work IMO)
Have you ever noticed that software is never advertised using the adjective "spreadable".
Re: New to Gambas.. seek some help
......probably by using Format() function:
https://gambaswiki.org/wiki/lang/format
https://gambaswiki.org/wiki/cat/userformat
Europaeus sum !
Amare memorentes atque deflentes ad mortem silenter labimur.
Amare memorentes atque deflentes ad mortem silenter labimur.
- cogier
- Site Admin
- Posts: 1129
- Joined: Wednesday 21st September 2016 2:22pm
- Location: Guernsey, Channel Islands
Re: New to Gambas.. seek some help
Welcome to the forum.
I agree with vuott regarding the number formatting, use Format. Run the following code in a Graphical application:-4. How to set fixed (0, 2 or 3) decimal places in those controls?
TextBox1 As TextBox
Spring1 As Spring
Label1 As Label
Public Sub Form_Open()
With Me
.Arrangement = Arrange.Vertical
.Padding = 5
.W = 250
.H = 100
End With
With TextBox1 = New TextBox(Me) As "TextBox1"
.H = 28
.Placeholder = "Enter any number below"
End With
Spring1 = New Spring(Me)
With Label1 = New Label(Me) As "Label1"
.H = 28
.Alignment = Align.Center
.Font.Bold = True
End With
End
Public Sub TextBox1_Change()
If Not IsNumber(Right(TextBox1.Text)) Then
TextBox1.Text = Left(TextBox1.Text, -1)
Return
Endif
Label1.Text = Format(TextBox1.Text, "0,.00")
End
Here I agree with BruceSteers try GridView. Have a look at BarcodeCreator that's on the Gambas Software Farm.1. Which controls allow multi-column display of data (listbox / listview)?
Re: New to Gambas.. seek some help
Thanks for responses. I wonder how active and dedicated you guys are (though the community is not so big.. but dedicated). I appreciate that.
@BruceSteers, @cogier many thanks for your response. Your dedication toward GAMBAS is appreciable. Wish you great luck!
About the queries:
1. Using Round() Function is a trick, not a solution.
2. Spin Box can accept decimal places (just a bit of work is required).
3. I seek support for largely used database systems (in the past too), not just SQLite. See, dBase,FoxPro, Visual FoxPro tables are still in use and people want to port them.
4. A Value Box is what I like most in GAMBAS controls but it need be capable to accept float values.
5. ListView control must also support multi-column data, I am sure (though I have not checked yet), there must be some confusion.
@BruceSteers, @cogier many thanks for your response. Your dedication toward GAMBAS is appreciable. Wish you great luck!
About the queries:
1. Using Round() Function is a trick, not a solution.
2. Spin Box can accept decimal places (just a bit of work is required).
3. I seek support for largely used database systems (in the past too), not just SQLite. See, dBase,FoxPro, Visual FoxPro tables are still in use and people want to port them.
4. A Value Box is what I like most in GAMBAS controls but it need be capable to accept float values.
5. ListView control must also support multi-column data, I am sure (though I have not checked yet), there must be some confusion.
Re: New to Gambas.. seek some help
Well, IDK anything about GAMBAS and my VB skills are rusted as I'm primarily working with VFP for dekstop apps but still this may do the trick after setting type to number:BruceSteers wrote: ↑Tuesday 6th February 2024 12:11am Q. How to configure valuebox to accept / not-accept decimal places?
3. With valuebox set it's Type property to the format you want then setting the Value property should be automatic displayed.
Public Sub valbox_Change()
Dim myFra As String
myfra = Str(Frac(valbox.value))
' Frac will return the number in digits like 0.xxxx
' Assuming to accept only 2 decimal places we would add 4 here two digits for 0. and two digits for decimal places
' Using round would round off the value like 2.256 would be 2.26
If Len(myFra) > 4 Then
valbox.Value = Int(valbox.Value) + Val(Left(myfra, 4))
Endif
End
Or if there's a way to add property to controls at runtime then,
1. Add property decimal_places as Integer
2. control.decimal_places=2
and call control.decimal_places from above procedure, replacing 4 with 2+control.decimal_places
Also if only integer is required in Value Box input then:
Public Sub valbox_Change()
valbox.Value = Int(valbox.Value)
End
- BruceSteers
- Posts: 1608
- Joined: Thursday 23rd July 2020 5:20pm
- Location: Isle of Wight
- Contact:
Re: New to Gambas.. seek some help
I only know good tricks
You will find all the gambas controls have their "default" behavior , to make them go beyond that you will need to employ some kind of "trick" or other.
With gambas there are many many tricks you can do to modify controls to work as you require.
Seems you have your own ideas on how it "should" be done so i do not think I have any advice except have fun experimenting
You will find all the gambas controls have their "default" behavior , to make them go beyond that you will need to employ some kind of "trick" or other.
With gambas there are many many tricks you can do to modify controls to work as you require.
Seems you have your own ideas on how it "should" be done so i do not think I have any advice except have fun experimenting
If at first you don't succeed , try doing something differently.
BruceS
BruceS