Jump to content

elGringo

uniGUI Subscriber
  • Posts

    434
  • Joined

  • Last visited

  • Days Won

    13

Everything posted by elGringo

  1. Hi, dear all. Learning ASP MVC. Question is in implementing MVC pattern in UniGUI framework. I want to understand,starting this discussion -is there any sense of implementing of this pattern in UNIGUI, cause main plus of MVC is better structure of app and better testing -what are concrete ways of implementations, maybe simple examples... -is someone tried? Any effort? Any experience? Share please your thoughts and practices you faced with. As for my thoughts Models code could be in MainModule Views are forms Controllers are separate units... On the other hand - traditional Delphi style codeing to form when everything is coded in form and that is bad practice, because it is good on the start, good as RAD approach, but after dozens of units it become to be a mess, don't you reckon like this? That is the starting point...
  2. When i was searching for slider in forum i found some posts, but couldn't apply those decisions. Also i found WOW slider - but it didn't work correct in my project. All of them was beautiful and amazing - that is true. But sometimes it is needed just some working decision. So I've created my simple simple slider. Working example is here Code below Getting pics for slider, lets say max number is 10 procedure TSlider.DataModuleCreate(Sender: TObject); var appPath:string; begin FSlidePathesSL:=TStringList.Create; FSlidePathesSL.Clear; if TFile.Exists( UniServerModule.StartPath+'pics\slides\1.jpg' ) then FSlidePathesSL.Add('pics\slides\1.jpg'); if TFile.Exists( UniServerModule.StartPath+'pics\slides\2.jpg' ) then FSlidePathesSL.Add('pics\slides\2.jpg'); if TFile.Exists( UniServerModule.StartPath+'pics\slides\3.jpg' ) then FSlidePathesSL.Add('pics\slides\3.jpg'); if TFile.Exists( UniServerModule.StartPath+'pics\slides\4.jpg' ) then FSlidePathesSL.Add('pics\slides\4.jpg'); if TFile.Exists( UniServerModule.StartPath+'pics\slides\5.jpg' ) then FSlidePathesSL.Add('pics\slides\5.jpg'); if TFile.Exists( UniServerModule.StartPath+'pics\slides\6.jpg' ) then FSlidePathesSL.Add('pics\slides\6.jpg'); if TFile.Exists( UniServerModule.StartPath+'pics\slides\7.jpg' ) then FSlidePathesSL.Add('pics\slides\7.jpg'); if TFile.Exists( UniServerModule.StartPath+'pics\slides\8.jpg' ) then FSlidePathesSL.Add('pics\slides\8.jpg'); if TFile.Exists( UniServerModule.StartPath+'pics\slides\9.jpg' ) then FSlidePathesSL.Add('pics\slides\9.jpg'); if TFile.Exists( UniServerModule.StartPath+'pics\slides\10.jpg' ) then FSlidePathesSL.Add('pics\slides\10.jpg'); end; We need uniImage on some Form or Frame, a named it iSlide in code Then we need unitimer on some Form or Frame. UniTimer works only on Form or Frame in UniGUI. Setting interval to 500 miliseconds!!! <<< And handling onTimer Event. procedure TClientForm.SliderTimerTimer(Sender: TObject); var picture: tpicture; begin picture:=TPicture.Create; try SliderTimer.Tag:=SliderTimer.Tag+1; if (SliderTimer.Tag=6) then UniSession.AddJS(iSlide.JSName + '.el.fadeOut({duration: 1000})'); if SliderTimer.Tag=8 then begin // nextSlide Inc(FSlideNumber); if FSlideNumber=FSlider.SlidePathesSL.Count-1+1 then FSlideNumber:=0; picture.LoadFromFile(UniServerModule.StartPath+FSlider.SlidePathesSL[FSlideNumber]); iSlide.Picture.Bitmap:=nil; iSlide.Picture.Assign(picture); end; if SliderTimer.Tag=8 then begin UniSession.AddJS(iSlide.JSName + '.el.fadeIn({duration: 1000})'); SliderTimer.Tag:=0; end; finally picture.Free; end; end; One thing to improve sliding, suggested by DD - is to use 2 uniimages to avoid white space beetwen slides. I will do it later and post here. Also other effects could be applied, not only fade - but for that we should look to Sencha docs API! Or I suppose jQuery also could be used here. Best wishes to all! If you have another decisions - please share. DD, special thanks for extJS fade effect!
  3. Not yet but i think it will work better then my))) For the moment my approach works if to set ampersand to the end UniSession.AddJS('window.open("/tinkoff.html?amount=123&")'); Now I will test your approach - don't want to give params in the URL!
  4. ok, 1 step closer, when I call like this UniSession.AddJS('window.open("/tinkoff.html?amount=123/")'); getting error (see pic)
  5. Thnks! I have read it already - I can open new window for the moment, just can't transfer params there and use them to call makePayment(myAmount, '123', '123', '123', '123', '123'); with my params
  6. I'm not a very good js coder - what are the ways to transfer params to new window to use them there?
  7. Form UniGUI call like that UniSession.AddJS('window.open("/tinkoff.html?amount=123")');
  8. doing like this but doesn't work - just need open new window and transfer params there <html> <head> <meta charset="utf-8"> <script src="https://securepay.tinkoff.ru/html/payForm/js/tinkoff.js"></script> <script type="text/javascript"> function makePayment(amount, orderId, description, name, email, phone) { var params = { //Код терминала (обязательный параметр), выдается банком. TerminalKey: "1491989692671DEMO", //Сумма заказа в копейках (обязательный параметр) Amount: amount, //Номер заказа (если не передан, принудительно устанавливается timestamp) OrderId: orderId, //Описание заказа (не обязательный параметр) Description: description, //Дополнительные параметры платежа DATA: "Email=" + email + "|Phone=" + phone + "|Name=" + name, //Флаг открытия платежной формы во фрейме Frame: false }; doPay(params); } function GetParam(search, name){ name=name+"="; var gp=""; if (search!='') { if (search.indexOf (name, 0)!=-1){ var startpos=search.indexOf(name, 0)+name.length; var endpos=search.indexOf("&",startpos); if (endpos<startpos) {endpos=search.length;} var gp=p.substring(startpos,endpos); } else { gp=""; } } else { gp=""; } return gp; } var p=window.location.search; var myAmount=GetParam(p, "amount"); makePayment(myAmount, '123', '123', '123', '123', '123'); </script> </html>
  9. Hello everyone, need an advice, having code from bank - script + html form I want to open new window from UniGUI APP with script <html> <head> <meta charset="utf-8"> <script src="https://securepay.tinkoff.ru/html/payForm/js/tinkoff.js"></script> <script type="text/javascript"> function makePayment(amount, orderId, description, name, email, phone) { var params = { //Код терминала (обязательный параметр), выдается банком. TerminalKey: "1491989692671DEMO", //Сумма заказа в копейках (обязательный параметр) Amount: amount, //Номер заказа (если не передан, принудительно устанавливается timestamp) OrderId: orderId, //Описание заказа (не обязательный параметр) Description: description, //Дополнительные параметры платежа DATA: "Email=" + email + "|Phone=" + phone + "|Name=" + name, //Флаг открытия платежной формы во фрейме Frame: false }; doPay(params); } makePayment('123', '123', '123', '123', '123', '123'); </script> </html> and give to this window params in spite of '123' - how to do that full code example <html> <head> <script src="https://securepay.tinkoff.ru/html/payForm/js/tinkoff.js"></script> <script type="text/javascript"> function makePayment(amount, orderId, description, name, email, phone) { var params = { //Код терминала (обязательный параметр), выдается банком. TerminalKey: "1491989692671DEMO", //Сумма заказа в копейках (обязательный параметр) Amount: amount, //Номер заказа (если не передан, принудительно устанавливается timestamp) OrderId: orderId, //Описание заказа (не обязательный параметр) Description: description, //Дополнительные параметры платежа DATA: "Email=" + email + "|Phone=" + phone + "|Name=" + name, //Флаг открытия платежной формы во фрейме Frame: false }; doPay(params); } </script> <style> .tinkoffPayRow { display: block; margin: 1%; width: 160px; } </style> </head> <body> <form name="TinkoffPayForm"> <input class="tinkoffPayRow" type="text" placeholder="Сумма заказа" name="paySum"> <input class="tinkoffPayRow" type="hidden" placeholder="Номер заказа" name="payOrder"> <textarea class="tinkoffPayRow" type="text" placeholder="Описание заказа" name="payDesc"></textarea> <input class="tinkoffPayRow" type="text" placeholder="ФИО плательщика" name="payName"> <input class="tinkoffPayRow" type="text" placeholder="E-mail" name="payEmail"> <input class="tinkoffPayRow" type="text" placeholder="Контактный телефон" name="payPhone"> <input class="tinkoffPayRow" type="button" onclick="makePayment(document.TinkoffPayForm.paySum.value.replace(/,/ig,'.') * 100, document.TinkoffPayForm.payOrder.value, document.TinkoffPayForm.payDesc.value, document.TinkoffPayForm.payName.value, document.TinkoffPayForm.payEmail.value, document.TinkoffPayForm.payPhone.value)" value="Оплатить"> </form> </body> </html>
  10. Be careful here - in js month started from 0 !!! so, to set 2017 04 10 you should write new Date(2017,03,10)
  11. Hello, how to disable all dates before today, and including today? It is impossible to get all dates from past to array
  12. set pFooter align to alNone - and disappeared for pFooter
  13. hello, Mohhamed! but i already have BorderStyle=None
  14. set to pHeader LayOutConfig 100% and whitespace from the right disappeared, but other ones still on th place
  15. Alignig panels on mainform, but viewing magic spaces - how to avoid them (see pics)? used margins 0 -10 0 0 but no effect it must be simple - but have no idea except margins how to fix it (( also - wanted to do sticky top menu - I think to handle on scroll browser event - is it correct how do you think? to set top:=0 on scroll to pHeader in test case TestCase https://yadi.sk/d/KrpRtzdo3GgVmZ
  16. it was customers link, i will ask him
  17. on the pic result of this code, it is border-corner of the panel, but frame still not effected
  18. Having TUniFrame created dynamically (TProductFrame) TUniPanel on TUniFrame trying to set border-radius - to both through CSS but no effect? Maybe other variant throught ExtJS? I need border-radius 5 px or box-shadow - tried both - no effect with border-radius was acting like this On ServerSide .border-radius{ border-radius: 10px } On Client Side function beforerender(sender, eOpts) { sender.addCls('border-radius'); }
  19. Cannot change color of panel to $257BB8 from object inspector it automatically changes to $00257BB8 - but it is different color - the same from code OnCreate if use CSS - also doesn't change - how to solve?
  20. Doing my shop, having -form with border style bsNone aligned all on mainForm which is mfPage Problem - blue - border visible - how to remove it?
  21. Question about aligns Having -MainForm -sbMain - scroll box on MainForm - ServerAlign - alClient -pLeft - panel on sbMain - ServerAlign - alLeft -pRight - panel on sbMain - ServerAligh - alClient Filling pLeft with MenuItems, pRight with Tiles and looking at horizontal scrollbox - that shouldn't be. Width of all elemens < sbMain.ClientWidth - why I see that? Can't understand. See pic attached TestCase https://yadi.sk/d/cG3wtY4U3GNJkh
×
×
  • Create New...