vbdavie Posted August 28, 2015 Share Posted August 28, 2015 The checkbox<boolean> field in a DBGrid doesn't not work as expected. There are TWO problems. PROBLEM #1: I would expect that when I click right inside the checkbox, that it will change it's status<from checked to unchecked>. But sadly, this is NOT the case. Example: 1. Load up the sample demo app that has the Grids, 2. Then CLICK INSIDE the checkbox of the "Boolean Field", it's like the 4th or 5th column. Keep clicking it until you see the checkmark CHANGE it's status. 3. NOW move the mouse one row down and click INSIDE the checkbox. You will notice that the checkbox does NOT change status. click it again and it WILL change the status 4. NOT, let's do something a little different. Let's move the mouse down one row and click on the word "true" or "false" that is NEXT to the checkbox. In fact you can click on ANY field in that row. 5. NOW, click inside the checkbox AND IT WILL change it's status. So, what does this mean? It means that until the row has been clicked<selected>, you are NOT able to change the status of the checkbox. That is not intuitive. I would think that if I positioned my mouse inside a checkbox and then clicked it, that the checkbox should CHANGE. I don't know if the problem is with extJS or in the uniGUI code, but I think you will agree that this is not the way that a user would expect it to work. PROBLEM #2: I want to calculate the number of checkboxes that the user checked and then display the total in some label. This ALMOST works. I have trapped several events. OnCellClick, OnCellContextClick, OnMouseUp, OnSetCellValue to no avail. It seems that when the checkmark changes<after I click in in>, my totaling logic is NOT called. BUT, the moment I click on some other field that is NOT a checkbox, then POOF, my totaling logic is called and it displays the correct number of checkmarks. It's as though the clicking of the checkbox does NOT trigger any of these events Am I missing a propery or something? Davie Quote Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted August 29, 2015 Administrators Share Posted August 29, 2015 Hello What is your uniGUI version? Quote Link to comment Share on other sites More sharing options...
vbdavie Posted August 29, 2015 Author Share Posted August 29, 2015 I cut/paste from the demo program program that I compiled. Library Version: 0.99.50.1189 I modified the TuniFrame called "umain" and stuck all my controls etc on it since it was free from a lot of stuff. All it had was an image. So, basically, I run the demo and the first thing I see on the right side of the treeview is my panel<tuniFrame> and then I start to test. Did you try my steps on YOUR system? Did you find that it worked as I described? Thanks Davie Quote Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted August 29, 2015 Administrators Share Posted August 29, 2015 Library Version: 0.99.50.1189 Is it trial edition? Quote Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted August 29, 2015 Administrators Share Posted August 29, 2015 Example: 1. Load up the sample demo app that has the Grids, 2. Then CLICK INSIDE the checkbox of the "Boolean Field", it's like the 4th or 5th column. Keep clicking it until you see the checkmark CHANGE it's status. 3. NOW move the mouse one row down and click INSIDE the checkbox. You will notice that the checkbox does NOT change status. click it again and it WILL change the status 4. NOT, let's do something a little different. Let's move the mouse down one row and click on the word "true" or "false" that is NEXT to the checkbox. In fact you can click on ANY field in that row. 5. NOW, click inside the checkbox AND IT WILL change it's status. So, what does this mean? It means that until the row has been clicked, you are NOT able to change the status of the checkbox. That is not intuitive. I would think that if I positioned my mouse inside a checkbox and then clicked it, that the checkbox should CHANGE. It happens because when you click a check box on grid it puts dataset into edit mode. When you change the row modified data is posted to dataset. Framework does not allow you to change checkbox from another row while dataset is in edit mode. To change this behavior you can set Column->CheckBoxField->AutoPost -> True. Quote Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted August 29, 2015 Administrators Share Posted August 29, 2015 PROBLEM #2: I want to calculate the number of checkboxes that the user checked and then display the total in some label. This ALMOST works. I have trapped several events. OnCellClick, OnCellContextClick, OnMouseUp, OnSetCellValue to no avail. It seems that when the checkmark changes, my totaling logic is NOT called. BUT, the moment I click on some other field that is NOT a checkbox, then POOF, my totaling logic is called and it displays the correct number of checkmarks. It's as though the clicking of the checkbox does NOT trigger any of these events You do not need to trap any events. Just set the Column->CheckBoxField->AutoPost to true then count the TRUE fields from the dataset. Quote Link to comment Share on other sites More sharing options...
vbdavie Posted August 29, 2015 Author Share Posted August 29, 2015 Fantastic. I set the autopost to TRUE. Let me test..... hold on..... :( Still no go. I went to the Grids/CheckBox demo and clicked on the LAST column that says "Auto Post=True". I think internally in the dataset, it's the last field called "Shift". Anyway, the demo grid works GREAT, but MY grid does NOT. I set the dataset OnAfterPost event to point to some method of mine to tally up the checkmarks. I presume that's the way to change the on-screen counter as the user palys with the checkmarks? Here's my grid definition for the grid that does NOT act correctly. object DBGridAccounts: TUniDBGrid Left = 16 Top = 312 Width = 425 Height = 107 Hint = '' ClicksToEdit = 1 DataSource = DataSource1 Options = [dgEditing, dgTitles, dgIndicator, dgColumnResize, dgColLines, dgRowLines, dgRowSelect, dgConfirmDelete] WebOptions.Paged = False WebOptions.PageSize = 999 WebOptions.FetchAll = True LoadMask.Message = 'Loading data...' OnDblClick = DBGridAccountsDblClick Anchors = [akLeft, akTop, akBottom] TabOrder = 16 OnColumnSort = DBGridAccountsColumnSort Columns = < item FieldName = 'Tag' Title.Caption = 'Tag' Width = 32 Visible = True Expanded = False Sortable = True CheckBoxField.AutoPost = True CheckBoxField.FieldValues = 'true;false' CheckBoxField.DisplayValues = 'Y;N' end item FieldName = 'Value' Title.Caption = 'Value' Width = 64 Visible = True Alignment = taRightJustify ReadOnly = True Expanded = False Sortable = True CheckBoxField.FieldValues = 'true;false' ShowSummary = True end item FieldName = 'Cash' Title.Caption = 'Cash' Width = 64 Visible = True Alignment = taRightJustify ReadOnly = True Expanded = False Sortable = True CheckBoxField.FieldValues = 'true;false' ShowSummary = True end item FieldName = 'Account' Title.Caption = 'Account' Width = 85 Visible = True ReadOnly = True Expanded = False Sortable = True CheckBoxField.FieldValues = 'true;false' ShowSummary = True end item FieldName = 'Company' Title.Caption = 'Company' Width = 125 Visible = True ReadOnly = True Expanded = False Sortable = True CheckBoxField.FieldValues = 'true;false' ShowSummary = True end item FieldName = 'Title' Title.Caption = 'Title' Width = 400 Visible = True ReadOnly = True Expanded = False Sortable = True CheckBoxField.FieldValues = 'true;false' ShowSummary = True end> end You can see that I set the AutoPost property. So, very wierd. There must be an ODD set of properties that ends up showing the odd behaviour. Maybe it's because mine is the first field instead of the last? I don't know, but it's wierd that one grid works fine and the other does NOT. Do you see anything out of the ordinary on mine? Davie Quote Link to comment Share on other sites More sharing options...
vbdavie Posted August 30, 2015 Author Share Posted August 30, 2015 GEEEEEEZ, I figured it out. See, the main form on the demo has a "Frame" control that contains the starting photo. I put all my controls on that frame and as I added controls to the "UMain.pas" , they woiuld appear on the MAIN form. No big deal, that's the way I expected the inheritence to work. BUT if I "changed" a control on the Umain <like the autopost> then those changes would NOT appear in the MAIN module. So, basically, I made the correct change, BUT it wasn't reflected on the MAIN screen I wasted a bunch of time discovering that. I noticed that as I moved a bunch of columns around in the dbgrid, the columns did NOT appear moved when I ran the program. I then looked at the "main" form and much to my amazment, the dbgrid was NOT updated. So, then I clicked the "Revert to Inheriited" menu item wihen I right clicked on the frame control on the MAIN form. That refreshed the MAIN form to use the CURRENT contents of the UMain frame So, niow the checkbox works. I wonder if there is a way to make it so that when any changes are made to a frame that ALL the forms that utilize the frame will auto-update. ??? Davie Quote Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted August 31, 2015 Administrators Share Posted August 31, 2015 So, niow the checkbox works. I wonder if there is a way to make it so that when any changes are made to a frame that ALL the forms that utilize the frame will auto-update. ??? Delphi does this as long as you don't change any property in the frames that are placed on other forms. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.