Jump to content
Guba

Getting/Restoring Column Width in TStringGrid with FMX

Recommended Posts

First of all HELLO to this Community.

My name is Sergio and I write from italy.
recently I have gone back to the development in Delphi, after 6 years missing devoted to other projects and jobs.

I'm beack with this new 10.3 Rio Community to start again re-learning what I did in the past and I decided to restart an old project about a Planetarium that I was developing for myself.
I have a question for the experts here,
I'm using Firemonkey and I noticed that there are a lot of differences among the old versions (I was on XE8) and the Rio version, where, for instance, the TDBGrid is disappeared and there is a TStringGrid to be used with the new projects.

I'd like to use the feature to resize a column, but also saing the new width to store it somewhere and to restore it once the program is reloaded again.
I noticed that there is not this kind of possibility throug the parameters of the component, so I'm asking for some help, if someone has already faced this problem (as I think it is).
Thanks a lot for this help in advance.
Stay so well to all the Community.
Guba

 

Share this post


Link to post

Hello,

 

when I want to change column width of the tStringGrid, I use: grZbozi.Columns[a].Width:=...

 

K.

 

 

Share this post


Link to post

Never heard about that. What is it ? A component of some kind ?

Also there is no google response...

Edited by Guba
complete

Share this post


Link to post

grZbozi is instance of tStringGrid, sorry for not writing it in my last reply. a is column index 🙂

Share this post


Link to post

Hey Friend, do you really think that this kind of posts maybe of any usefulness ?
FRANLKY?
1. If you reply to a request you must make who asks in the position to find what you describe.

2. you must read what the poster (me) writes in his replays, because it is important. this thing you talk about cannot be found anywhere, not here, nor on google.

3. if you can't understand these simple rules please avoid to make the others to loose their time searching for something that is only in your head. EGO is of no usefulness in this place. What you want to demonstrate with such behavior ? That you can solve my probblem while I cannot ? We're all technician here, and if you want to speak technic, do it well.

4. avoid such kind of behaviour in the future, because it is unethical, useless and time wasting. If you want to help, do it right.

Regards.

 

  • Sad 1

Share this post


Link to post
33 minutes ago, Guba said:

Hey Friend, do you really think that this kind of posts maybe of any usefulness ?
FRANLKY?
1. If you reply to a request you must make who asks in the position to find what you describe.

2. you must read what the poster (me) writes in his replays, because it is important. this thing you talk about cannot be found anywhere, not here, nor on google.

3. if you can't understand these simple rules please avoid to make the others to loose their time searching for something that is only in your head. EGO is of no usefulness in this place. What you want to demonstrate with such behavior ? That you can solve my probblem while I cannot ? We're all technician here, and if you want to speak technic, do it well.

4. avoid such kind of behaviour in the future, because it is unethical, useless and time wasting. If you want to help, do it right.

Regards.

 

What are you smoking?
Maybe you as technician should lern to read the docs?
http://docwiki.embarcadero.com/Libraries/Rio/en/FMX.Grid.TStringGrid_Properties

Share this post


Link to post

Well, in your question, you wrote "TStringGrid to be used with the new projects.". So my answer was for tStringGrid, unfortunatelly I did not clearly write it in my answer and I have already apologized about it.

So when you are using tStringGrid, it has indexed property Columns. Each column has property Width. I believe that with this information you can set width of columns (I am using it and it works) and probably you can also read current widths of columns (which I do not use).

Try to google FMX TStringGrid Columns.

 

 

Share this post


Link to post
48 minutes ago, Guba said:

[...] if you want to help, do it right.

Well ... @Guba, if you want to receive help, do it right.

You're pretty new in this community and I recommend you to read our Code of Conduct. We all are trying to help each other. Sometimes we read an answer to our question and we cannot see how that one could help us. Yes, that happens from time to time. Asking helps.

So, please calm down now and let's see how to answer your questions about FMX. And yes, especially when it comes to grids and databases, there are significant differences to the traditional VCL.

Share this post


Link to post

I see that I have to apologize for my behaviour. Franlky I do not understand what does it mean this " grZbozi " thing, and I'm a bit nervous when someone is so much telegraphic in his replies.
If I have offended someone please accept my apologies.

But I'm 61, and I have seen too many times such kind of "synthetic" replies that lead to nothing. Also I have tried the property WIDTH, but unless you have a behavior that is fired when the resize occurs, there is no possibility to read/store the WIDTH of the coulmn.
OK. that's all.
the Coronavirus here has med another victim, my patience.

Stay well you all.

 

Share this post


Link to post

And do you need the widths immediatelly after the column resize happens? If not, you can read and store column widths in tForm.OnClose.

  • Like 1

Share this post


Link to post

My apologies again, I was acting like an asshole. Sorry....
Well, it is a long time that I do not code. I was completely forgetting that there are many other occasions when I can act like, for instance, the OnFormClose event.

My problem, if I can say so, is to resize the columns just a bit before to show the form and then save the width before closing, or on closing.
I'm gonna try this now. However, can you explain what is this grZbozi ? Is it a library of components ? Where can I find it to study ?
Thanks again.

 

  • Like 1

Share this post


Link to post

Apologies accepted 🙂

grZbozi is just an instance of tStringGrid on my form in the app, from which I have copied that example. So if you put a tStringGrid in your project, it will probably be StringGrid1 instead. In my form, there is declared grZbozi: tStringGrid;

Share this post


Link to post

I see. OK. I will try as soon as I'm back to the job. Now I'm following the Coronavirus developments. I'm in Italy in the north, 30 km from Milan....
BTW did you ever used a dual monitor configuration ? Just to have the Livebindings window open by itself, which is large.
In 10.3 is it possible to configure an IDE interface just only with the LiveBindings ?
Thanks for the suggestion.
 

Share this post


Link to post

I have two monitors, but normaly work on VCL apps. FMX is new for me. Livebindings windows - ehm, I am glad that I almost do not need it; I just connected whole tStringGrid to tIBQuery or tIBDataSet and then edited columns. Now I hope that I will never have to open the Livebindings window again, because it probably would need more than just two monitors 🙂

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×