msegura Posted June 12, 2014 Posted June 12, 2014 Hi everyone, Does anyone know how I could set enabled a uniTimer from an event in client side? Thank in advanced!!! Quote
Sherzod Posted June 12, 2014 Posted June 12, 2014 Hi msegura. This approach is suitable? 1. procedure TMainForm.UniTimer1EventHandler(Sender: TComponent; EventName: string; Params: TStrings); begin if (not (Sender as TUniTimer).Enabled) and (EventName = '_start') then begin (Sender as TUniTimer).Enabled := True; end; end; 2. Set enabled: procedure TMainForm.UniButton1Click(Sender: TObject); begin UniSession.AddJS('ajaxRequest(' + UniTimer1.JSName + ', ''_start'', []);'); end; or just: procedure TMainForm.UniButton1Click(Sender: TObject); begin UniTimer1.Enabled := True end; Sincerely. Quote
msegura Posted June 12, 2014 Author Posted June 12, 2014 Hi and thank you very much for answering so quickly. It's a good approach but unfortunately it doesn't work for my case. I have a form where there is a dbgrid. What I need is to update a combobox when a column is clicked to be ordered. I change the tabindex property of the combobox on the event OnColumnSort of the grid but the combo is not updated. That's why I thougth to use a timer as I read on some post of this forum. I do not wan to have the timer triggering events constantly so when the combobox is updated I disable it. The problem is that I can't enable the timer again. Any ideas? Thank you very much. Quote
Administrators Farshad Mohajeri Posted June 13, 2014 Administrators Posted June 13, 2014 Tabindex?? Quote
Sherzod Posted June 13, 2014 Posted June 13, 2014 Hi msegura. Can you give a simple test case? Best regards. Quote
docjones Posted June 13, 2014 Posted June 13, 2014 Use latest version of unigui if you change unicombobox.itemindex := value , combobox will be updated. another solution : Create a table with the content of the combobox. (in database or in memory) Put a UniDBLookupComboBox instead a combobox, , set listsource to a dataset to this table, set listfield and keyfield, when you click in the dbgrid and OnColumnSort event is generated, set UniDBLookupComboBox.keyvalue to your columname or value. Quote
msegura Posted June 13, 2014 Author Posted June 13, 2014 Hello and thankyou for your answered. Farshad, itemindex I meant. Anyway I'm preparing a proyect in order you can see what my problem is. Thank you very much. Quote
msegura Posted June 13, 2014 Author Posted June 13, 2014 I've already prepared a proyect to show you the problem. This project is based on the Column Sort demo. You can also find attached a screen shot of the real project. I need that combo because it is important for users used to the old interface and it is neccesary they have a soft transitions between the old interface and the new one. Thank you very much for your help. ColumnSort.zip Quote
Sherzod Posted June 14, 2014 Posted June 14, 2014 Hi msegura!Sorry, to be honest, the problem is not very clear to me ...I do not see two-way communication with the combobox.If I understand correctly, try to include this code: procedure TMainForm.UniComboBox1Change(Sender: TObject); begin UniSession.AddJS(UniDBGrid1.JSName + '.getStore().sort({ property: ''' + IntToStr(UniComboBox1.ItemIndex) + ''', direction : ''ASC''});'); end; If I do not understand correctly, please again clarify the problem, I'll be glad to help you!Sincerely. Quote
msegura Posted June 14, 2014 Author Posted June 14, 2014 Thank you very much for your answer again. The piece of code in your answer is very useful for me, thank you. But It does not solve my real problem which is in the opposite way. What a I need is to change the value of the combox when the grid is ordered by pressing on the column name. You can see the code for UniDBGrid1ColumnSort where I change the value of ItemIndex of ComboBox ( UniComboBox1.ItemIndex := Column.Index;) but visually it is not changed. Thank you very much!!! procedure TMainForm.UniDBGrid1ColumnSort(Column: TUniDBGridColumn; Direction: Boolean); begin UniMainModule.SortColumn(Column.FieldName, Direction); // Here is my problem. I change the ItemIndex but visually // the combo does not change and it always shows the same value UniComboBox1.ItemIndex := Column.Index; end; Quote
Sherzod Posted June 14, 2014 Posted June 14, 2014 Strangely, I have combobox value is updated when I click on any header column! UniGUI version: 0.95.0.1044 Tested in FF 29.0.1 Quote
msegura Posted June 14, 2014 Author Posted June 14, 2014 Oh my God, I'm depressed!! It does not work for me neither FF 20.0.1 nor Chrome 35.0. The sample project I sent is compiled with Rad Studio XE4 and Unigui 0.95.0.1041 Any ideas what's happening or how could I work arround to solve it? Thanks in advanced. Quote
msegura Posted June 14, 2014 Author Posted June 14, 2014 I thought I was using the latest version of unigui. I'm going to update it to 0.95.0.1046 and I will try. Thank you. Quote
Sherzod Posted June 14, 2014 Posted June 14, 2014 And so you can change the value of combobox, try UniDBGrid1 -> ClientEvents -> ExtEvents -> add function sortchange: function sortchange(ct, column, direction, eOpts) { Ext.getCmp(MainForm.UniComboBox1.id).select(Ext.getCmp(MainForm.UniComboBox1.id).getStore().getAt(column.dataIndex)); } Best regards. Quote
msegura Posted June 14, 2014 Author Posted June 14, 2014 It works with the latest version of unigui 0.95.0.1046. I'm a fool. Thank you very much for your help. Best regards Quote
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.