andyhill Posted October 17, 2017 Share Posted October 17, 2017 Can someone please show me how to add a Custom Button (far right) to the uniMainmForm Caption Bar and capture the tap (click) event - thanks in advance. Link to comment Share on other sites More sharing options...
Sherzod Posted October 18, 2017 Share Posted October 18, 2017 Hi, Look at this demo: \FMSoft\Framework\uniGUI\Demos\Touch\TitleButtons MainmForm -> TitleButtons procedure TMainmForm.UnimFormTitleButtonClick(Sender: TUnimTitleButton); begin case Sender.ButtonId of 0 : 1 : end; end; Best regards, Link to comment Share on other sites More sharing options...
andyhill Posted October 18, 2017 Author Share Posted October 18, 2017 Will do, thanks for the pointer. Link to comment Share on other sites More sharing options...
andyhill Posted October 18, 2017 Author Share Posted October 18, 2017 Moving ahead, 1) I want to be able to choose button position on TitleBar (left / right) 2) I want to be able to place text between buttons Please advise - thanks Link to comment Share on other sites More sharing options...
andyhill Posted October 18, 2017 Author Share Posted October 18, 2017 3) Can I place a DatePicker on the TitleBar ? Link to comment Share on other sites More sharing options...
Sherzod Posted October 18, 2017 Share Posted October 18, 2017 Hi, 3) Can I place a DatePicker on the TitleBar ? You can try this approach: procedure TMainmForm.UnimFormReady(Sender: TObject); begin UniSession.AddJS('MainmForm.titlebar.insert(2, {xtype: "datepickerfield", value: new Date()});'); end; Link to comment Share on other sites More sharing options...
Sherzod Posted October 18, 2017 Share Posted October 18, 2017 2) I want to be able to place text between buttons procedure TMainmForm.UnimFormReady(Sender: TObject); begin UniSession.AddJS('MainmForm.titlebar.insert(2, {xtype: "label", html: " Text"});'); end; Link to comment Share on other sites More sharing options...
andyhill Posted October 18, 2017 Author Share Posted October 18, 2017 Fantastic, now all I need is to capture the date change in Delphi plus set the date in Delphi. Link to comment Share on other sites More sharing options...
Sherzod Posted October 18, 2017 Share Posted October 18, 2017 Fantastic, now all I need is to capture the date change in Delphi plus set the date in Delphi. For example: procedure TMainmForm.UnimFormReady(Sender: TObject); begin UniSession.AddJS('MainmForm.titlebar.insert(2, {xtype: "datepickerfield", value: new Date(), listeners: {change: function(el, v){ajaxRequest(MainmForm.form, "_change", [])}}});'); end; procedure TMainmForm.UnimFormAjaxEvent(Sender: TComponent; EventName: string; Params: TUniStrings); begin if EventName = '_change' then ShowMessage('change'); end; And try to use like this approach: http://forums.unigui.com/index.php?/topic/9298-unidbgrid-tray-add-objects-buttons/&do=findComment&comment=48258 Link to comment Share on other sites More sharing options...
andyhill Posted October 18, 2017 Author Share Posted October 18, 2017 Thank you, I will experiment with these concepts Link to comment Share on other sites More sharing options...
andyhill Posted October 18, 2017 Author Share Posted October 18, 2017 All good, I was not sure if the mobile version was different. Can I say that the Sencha Mobile Framework looks really great. Also, your uniGUI is growing on me. Link to comment Share on other sites More sharing options...
andyhill Posted October 18, 2017 Author Share Posted October 18, 2017 I am still trying to TitleBar Right Align Button ? UniSession.AddJS('MainmForm.titlebar.insert(2, {xtype: "button", text: 'Today', id: "syncDatesID", listeners: {tap: function(el, v) {ajaxRequest(MainmForm.form, "_syncButton", [])}}});'); Please advise. Link to comment Share on other sites More sharing options...
Sherzod Posted October 19, 2017 Share Posted October 19, 2017 Hi, You can follow this sequence: 1. Let's say MainmForm -> TitleButtons = [] - "isEmpty" 2. MainmForm -> TitleButtons -> add "0 - TUnimTitleButton-0": -> Separator=True 3. Just for information: TitleBar -> items[0] - this is MainmForm.Caption 4. Now we have two items: items[0] -> MainmFormCaption items[1] -> "Separator" 5. By specifying the index <= 1, the item will be located on the left side, otherwise on the right... MainmForm.titlebar.insert(Index, {}); This is one of the possible solutions, try... Best regards, Link to comment Share on other sites More sharing options...
andyhill Posted October 19, 2017 Author Share Posted October 19, 2017 I need "Today" button on Right, your suggestion does not work nor the other half dozen I have tried - Please advise. UniSession.AddJS('MainmForm.titlebar.insert(2, '+ '{ '+ 'xtype: "button", '+ 'text: '+QuotedStr('Today')+', '+ 'id: "syncTodayID", '+ 'listeners: {tap: function(el, v) {ajaxRequest(MainmForm.form, "_syncToday", [])}}'+ '} );'); Link to comment Share on other sites More sharing options...
Sherzod Posted October 19, 2017 Share Posted October 19, 2017 2. MainmForm -> TitleButtons -> add "0 - TUnimTitleButton-0": -> Separator=True Have you added ?! Link to comment Share on other sites More sharing options...
Sherzod Posted October 19, 2017 Share Posted October 19, 2017 Or you can use this: UniSession.AddJS('MainmForm.titlebar.insert(YourIndex, {xtype: "spacer"});'); Link to comment Share on other sites More sharing options...
andyhill Posted October 19, 2017 Author Share Posted October 19, 2017 Farshad, Please look at the image above, I want the "Today" button Right Aligned - please advise. Link to comment Share on other sites More sharing options...
Sherzod Posted October 19, 2017 Share Posted October 19, 2017 Please, make a testcase, only with TitleButtons Link to comment Share on other sites More sharing options...
andyhill Posted October 19, 2017 Author Share Posted October 19, 2017 http://www.axfite.com.au/files/Test.zip Link to comment Share on other sites More sharing options...
Sherzod Posted October 19, 2017 Share Posted October 19, 2017 http://www.axfite.com.au/files/Test.zip procedure TMainmForm.UnimFormReady(Sender: TObject); begin UniSession.AddJS('MainmForm.titlebar.insert(2, '+ '{ '+ 'xtype: "spacer"'+ '} );'); UniSession.AddJS('MainmForm.titlebar.insert(3, '+ '{ '+ 'xtype: "button", '+ 'text: '+QuotedStr('Today')+', '+ 'id: "syncTodayID", '+ 'listeners: {tap: function(el, v) {ajaxRequest(MainmForm.form, "_syncToday", [])}}'+ '} );'); end; Link to comment Share on other sites More sharing options...
andyhill Posted October 19, 2017 Author Share Posted October 19, 2017 No, makes no differance Link to comment Share on other sites More sharing options...
Sherzod Posted October 20, 2017 Share Posted October 20, 2017 Link to comment Share on other sites More sharing options...
andyhill Posted October 20, 2017 Author Share Posted October 20, 2017 You are absolutely correct (I missed the 3) - thanks for your patience Farshad Link to comment Share on other sites More sharing options...
Recommended Posts