Issue with Inactive DataControl Fields
Posted
#1
(In Topic #1402)
Trainee
I’m experiencing an issue with DataControl fields in my project. Even though the Field properties are correctly assigned, the DataControl fields remain inactive. Has anyone encountered a similar problem? Could I be missing some configuration or approaching data binding incorrectly?
Code
Public Sub Form_Open()
Dim $con As New Connection
Try $con.Close() ' Close the connection. The try allows it to fail without error
$con.Type = "sqlite3" ' Defines the type of connection
$con.Host = Application.path ' Host will be the path where the sqlite db file is
$con.Name = "klienci.db" ' database name is the name of the database file
$con.Open ' We activate and open the connection, the try is to allow an error
Print "Connected? : " & $con.Opened ' It will return TRUE or FALSE depending on whether "try $con.Open()" was successful in "conectarodbc()"
DataSource1.Connection = $con
DataBrowser1.Labels = ["ID", "IMIĘ", "NAZWISKO", "EMAIL", "TELEFON", "ADRES", "DATA REJ.", "STATUS", "NOTATKI"]
DataBrowser1.Update
End
Posted
Guru

Post a copy of the form so we can see how you have laid out the text controls.
Posted
Trainee
Posted
Guru

(you can make it into a .zip and add it to post)
most likely you have set "Arrangement" on the form so it is trying to auto-position/size things.
If Arrangement property is set then you must do some other things like place the Label/Textbox pairs into containers (Panel/HBox's)
Or do not set the form Arrangement property and make it non-resizable window
if you post the actual from i could help with it's layout.
Posted
Trainee
Thanks for Your help.
EDIT:
New form, new DB, same problem. Label1 + Data Control1 are in container. etc. Some fields DataControl are invisible.
Posted
Guru

(I was wrong about it being a layout issue)
With no database to load i find ALL the DataControl boxes are hidden.
Maybe it's a problem with the Field names?
can you send a piece of the database to test with?
Posted
Guru

Posted
Trainee
Yea, maybe its good idea, but problem not solved. Thanks…BruceSteers said
An alternative may be to use the DataBrowser.Editable property so you can just edit the items in the browser and not have the DataControls at all.
EDIT:small
From Gambas Software Farm, demonstrate program Database Editor. There is a small info:
' Use Main To start up this program because there Is a bug In gambas that
' causes data-bound controls (e.g.DataCombo) to misbehave if connection is
' set to a DataSource after the controls have been already initialized.
' This means that creating the connection in Form_Open() is too late.
Posted
Guru

LeszekK said
Ok, db uploaded. 2 diffrent db. Same problem.Yea, maybe its good idea, but problem not solved. Thanks…BruceSteers said
An alternative may be to use the DataBrowser.Editable property so you can just edit the items in the browser and not have the DataControls at all.
EDIT:small
From Gambas Software Farm, demonstrate program Database Editor. There is a small info:' Use Main To start up this program because there Is a bug In gambas that
' causes data-bound controls (e.g.DataCombo) to misbehave if connection is
' set to a DataSource after the controls have been already initialized.
' This means that creating the connection in Form_Open() is too late.![]()
![]()
Aah i see
Maybe try opening connection in _new() instead of Form_Open()
Public Sub _new()
End
Posted
Guru

I have 3.20 and now i can test with your example db file I do not get any problems
So i would say your approach is just fine.
have you tried a different gtk theme? or using qt instead of gtk to see if it's different?
1 guest and 0 members have just viewed this.






