Jump to content

tappatappa

uniGUI Subscriber
  • Posts

    333
  • Joined

  • Last visited

  • Days Won

    7

Everything posted by tappatappa

  1. This may seem a weird question. So I am upgrading my machine to a Win10/Rad Studio 10 setup. I need to produce an ISAPI Module compatible with IIS7, but I see that now the uniGUI/ISAPI module project produces cpl files? Am I doing something wrong? Please help!
  2. Hello ZigZig, I am trying. Is not remotely as easy as I hoped Moreover, I guess I have to make it more flexible by retrieving the uniGUI/extjs version from ServerModule. How do I have to change the path in Stand Alone Server mode (I see you refer to the dll in the paths)?
  3. In MegaDemo procedure TMainForm.ThemeClick(Sender: TObject); begin if UniApplication<>nil then begin UniServerModule.Lock; try case TComponent(Sender).Tag of 1 : UniServerModule.CurrentTheme:='blue'; 2 : UniServerModule.CurrentTheme:='gray'; 3 : UniServerModule.CurrentTheme:='classic'; 4 : UniServerModule.CurrentTheme:='xp'; 5 : UniServerModule.CurrentTheme:='vista'; end; finally UniServerModule.UnLock; end; TUniGUIApplication(UniApplication).Restart; end; end; Is it possible to implement a similar feature without changing UniServerModule and restarting the Application?
  4. ok I wrote a shell script that generates the cbproj file sed -e 's/<AppType>Application<\/AppType>/<AppType>Library<\/AppType>/g' \ -e "s/<Config Condition=\"'\$(Config)'==''\">Debug<\/Config>/<Config Condition=\"'\$(Config)'==''\">Release<\/Config>/g" \ -e 's/<ProjectType>CppVCLApplication<\/ProjectType>/<ProjectType>CppManagedDynamicLibrary<\/ProjectType>/g' \ -e 's/<Borland\.ProjectType>CppVCLApplication<\/Borland\.ProjectType>/<Borland.ProjectType>CppManagedDynamicLibrary<\/Borland.ProjectType>/g' \ -e 's/<ProjectGuid>{[a-zA-Z0-9\-]*}<\/ProjectGuid>/<ProjectGuid>{3D9AD1F9-86F9-468A-AE84-AA46B52285E8}<\/ProjectGuid>/g'\ < myproject.cbproj > myproject_DLL.cbproj plus you need to put some #ifdef here and there, especially in the MainSource (myproject.cpp) #ifdef MYPROJECT_DLL #include <ActiveX.hpp> #include <ComObj.hpp> #include <UniGUIISAPI.hpp> #include <Isapi2.hpp> #else #include <UniGUIVars.hpp> #endif //.....USEFORM..... #ifdef MYPROJECT_DLL #pragma link "uniguiisapi.obj" #else #pragma link "UniGUIVars.obj" #pragma MyProject #endif #pragma package(smart_init) #ifdef MYPROJECT_DLL #define __DLL_OBFUSCATE(a, a##b //--------------------------------------------------------------------------- int WINAPI __DLL_OBFUSCATE(DllEnt,ryPoint) (HINSTANCE hinst, unsigned long reason, void*) { try { if (reason == DLL_PROCESS_ATTACH) { CoInitFlags = COINIT_MULTITHREADED; } } catch (Exception &exception) { } return 1; } //--------------------------------------------------------------------------- extern "C" { BOOL __declspec(dllexport) WINAPI GetExtensionVersion(Isapi2::THSE_VERSION_INFO &Ver) { return Uniguiisapi::GetExtensionVersion(Ver); } //--------------------------------------------------------------------------- unsigned __declspec(dllexport) WINAPI HttpExtensionProc(Isapi2::TEXTENSION_CONTROL_BLOCK &ECB) { return Uniguiisapi::HttpExtensionProc(ECB); } //--------------------------------------------------------------------------- BOOL __declspec(dllexport) WINAPI TerminateExtension(int dwFlags) { return Uniguiisapi::TerminateExtension(dwFlags); } } #else //--------------------------------------------------------------------------- WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int) { try { Forms::Application->Initialize(); Uniguivars::CreateServerModule(__classid(TUniServerModule)); Application->Run(); } catch (...) { } return 0; } #endif
  5. I was wondering whether is possible to write a c++builder project (.cbproj) where you can produce a Stand-Alone Application (.exe) with the Debug Configuration, and a ISAPI DLL with the Release Configuration. Currently I work with two separate projects but this is painful because when I add a new unit to the "Debug project" I have to remember to add it to the "Release project", too. This rarely happens, of course, and causes all sorts of problems during release (compiling/linking/runtime errors...) Beside auto-generating the .cbproj, what alternatives do I have?
  6. You mean creating a custom control derived from TUniGenericControl? Otherwise how do you use GenericControl?
  7. Hi delphidude, thanks for the reply. The thing is: in the actual project I work with the UniCanvas->BitmapCanvas (which is the "actual" TCanvas) a lot. How am I supposed to work with a JS canvas like the one you suggested?
  8. I don't know if is a missing feature, but I can't read the tshiftstate in a OnMouseDown event void __fastcall TFrame1::UniCanvasMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y) { if (Shift.Contains(ssShift)) //do stuff else //do other stuff } the code above always executes the "else" branch. Any ideas / workarounds?
  9. I don't know what I did, but after a bit of cleaning/refactoring now the problem disappeared. JavaScript will always be a mystery to me. Problem solved! Thanks again.
  10. Delphi Developer, you are my hero. Ok now I suspect that I have introduced a weird glitch in the datetimepicker: I have to click 2 times on the day to make the calendar disappear. Do you experience the same thing?
  11. I am trying to implement date ranges using uniGUI Date Time Pickers. I am following this guide I am almost finished, but I am facing a big problem. I hope someone can help! Step 1 (VTypes and daterange, copy/paste from the article): UniSession()->AddJS(L" Ext.apply(Ext.form.VTypes,\ { daterange : function(val, field)\ {\ var date = field.parseDate(val);\ if(!date){return false;}\ if (field.startDateField && (!this.dateRangeMax || (date.getTime() != this.dateRangeMax.getTime())))\ {\ var start = Ext.getCmp(field.startDateField);\ start.setMaxValue(date);\ start.validate();\ field.dateRangeMax = date;\ }\ else if (field.endDateField && (!this.dateRangeMin || (date.getTime() != this.dateRangeMin.getTime())))\ {\ var end = Ext.getCmp(field.endDateField);\ end.setMinValue(date);\ end.validate();\ field.dateRangeMin = date;\ }\ return true;\ },\ });"); Step 2 (beforeInit): dtp_START->ClientEvents->UniEvents->Values[L"beforeInit"] = L" function(sender)\ {\ Ext.apply(sender, {\ vtype: 'daterange',\ endDateField: '"+dtp_FINAL->JSName+L"'\ });\ }"; dtp_FINAL->ClientEvents->UniEvents->Values[L"beforeInit"] = L" function(sender)\ {\ Ext.apply(sender, {\ vtype: 'daterange',\ startDateField: '"+dtp_START->JSName+L"'\ });\ }"; ....and here is the problem. JSName is always NULL at this point. I don't know if it is a bug or is because how uniGUI works. So, i tried this workaround dtp_START->ClientEvents->UniEvents->Values[L"beforeInit"] = L" function(sender)\ {\ if("+form->Name+L"[\""+dtp_FINAL->Name+L"\"])\ {\ Ext.apply(sender, {\ vtype: 'daterange',\ endDateField: "+form->Name+L"[\""+dtp_FINAL->Name+L"\"].id\ });\ }\ }"; dtp_FINAL->ClientEvents->UniEvents->Values[L"beforeInit"] = L" function(sender)\ {\ if("+form->Name+L"[\""+dtp_START->Name+L"\"])\ {\ Ext.apply(sender, {\ vtype: 'daterange',\ startDateField: "+form->Name+L"[\""+dtp_START->Name+L"\"].id\ });\ }\ }"; but this is not enough, since the Ext.appy is called only for the SECOND picker that is initialized. As a result, only one datetimepicker is constrained. Calling Ext.apply for BOTH pickers in both beforeInit events doesn't help, since only one datetimepicker (the sender) is initialized correclty anyway. HELP!
  12. I sincerely hope not. But you can always simulate a stateless application, I guess.
  13. Thanks for the compliment, but really I didn't do anything magical! Since uniGUI uses ExtJS 4, usually I just try to google the solution "ExtJS side" https://www.google.it/search?q=extjs+stick+top+right ...and then proceed from that. ExtJS has a pretty good documentation, too!
  14. Thanks for your reply. In order to make it work for a single SpeedButton I had to implement a little trick void __fastcall TForm1::ButtonSpeedAClick(TObject *Sender) { static bool speedAstate = false; ButtonSpeedA->Down = !speedAstate; speedAstate = !speedAstate; }
  15. Can someone explain to me how does UniSpeedButton->Down works? My guess is that SpeedButton has two states (Down and Up) and can be used as a "checkbox" (Checked true/false), but void __fastcall TForm1::ButtonSpeedClick(TObject *Sender) { ButtonSpeed->Down = !ButtonSpeed->Down; } does nothing (graphically)
  16. Ok I think I found it. ClientEvents "window.show" function(sender,eOpts) { sender.alignTo(Ext.getBody(), 'tr-tr'); sender.anchorTo(Ext.getBody(), 'tr-tr'); }
  17. Is there a way (Delphi or JavaScript side) to force a form to stick to the upper right corner of the browser window?
  18. 0.99.0.1161 Implemented Add AddIcon AddMasked Not Implemented Delete Clear
  19. Come on! Is non THAT hard! For starters, here is a quick and dirty port (I am not even sure that compiles). If you can improve it please reply with your solution. procedure fixDateTimePicker(dt:TUniCustomDateTimePicker) var dtp: TUniDateTimePicker; dbdtp: TUniDBDateTimePicker; kind: TUniDateTimeKind; ev: string; begin dtp := nil; dbdtp := nil; if dt is TUniDateTimePicker then begin dtp := dt as TUniDateTimePicker; kind := dtp.Kind; end elsif dt is TUniDBDateTimePicker then begin dbdtp := dt as TUniDBDateTimePicker; kind := dbdtp.Kind; end else Exit; ev := ' function(sender) { sender.editable = false; }'; if (kind = tUniDate) or (kind = tUniTime) then begin if (dtp <> nil) then dtp.ClientEvents.ExtEvents.Values['afterrender'] := ev elsif (dbdtp <> nil) then dbdtp.ClientEvents.ExtEvents.Values['afterrender'] := ev; end else begin if (dtp <> nil) then begin dtp.ClientEvents.ExtEvents.Values['date.afterrender'] := ev; dbdtp.ClientEvents.ExtEvents.Values['time.afterrender'] := ev; end elsif (dbdtp <> nil) then begin dtp.ClientEvents.ExtEvents.Values['date.afterrender'] := ev; dbdtp.ClientEvents.ExtEvents.Values['time.afterrender'] := ev; end; end; end;
  20. Glad to be of help. I just copy-pasted a function I wrote a while ago.
  21. static void fixDateTimePicker(TUniCustomDateTimePicker * dt) { TUniDateTimePicker * dtp = dynamic_cast<TUniDateTimePicker*>(dt); TUniDBDateTimePicker * dbdtp = dynamic_cast<TUniDBDateTimePicker*>(dt); TUniDateTimeKind kind; if (dtp != NULL) kind = dtp->Kind; else if (dbdtp != NULL) kind = dbdtp->Kind; else return; UnicodeString ev = L" function(sender) { sender.editable = false; }"; if (kind == tUniDate || kind == tUniTime) { if (dtp != NULL) dtp->ClientEvents->ExtEvents->Values[L"afterrender"] = ev; else if (dbdtp != NULL) dbdtp->ClientEvents->ExtEvents->Values[L"afterrender"] = ev; } else { if (dtp != NULL) { dtp->ClientEvents->ExtEvents->Values[L"date.afterrender"] = ev; dtp->ClientEvents->ExtEvents->Values[L"time.afterrender"] = ev; } else if (dbdtp != NULL) { dbdtp->ClientEvents->ExtEvents->Values[L"date.afterrender"] = ev; dbdtp->ClientEvents->ExtEvents->Values[L"time.afterrender"] = ev; } } } this works for both DB and non-DB components.
  22. If you use them as query parameters try using a TUniDBDateTimePicker (attached to a VirtualTable or something equivalent) and see if they are affected by the same bug. Anyway, open a Bug Report.
  23. I have never used TUniDateTimePicker to show seconds! Have you opened a Bug Report? Sorry but I cannot advise you a good replacement for that. Maybe a DatePicker+ComboBox? Do you really need the seconds?
  24. void __fastcall TMainForm::UniFormShow(TObject *Sender) { TDateTime dtTime1 = StrToTime(L"00:00:00"); TDateTime dtTime2 = StrToTime(L"23:59:59"); UniDateTimePicker1->DateTime = TDateTime::CurrentDate() - 1 + dtTime1; UniDateTimePicker2->DateTime= TDateTime::CurrentDate() + dtTime2; } You have to assign values to DateTimePicker->DateTime
×
×
  • Create New...