Administrators Farshad Mohajeri Posted May 16, 2011 Administrators Posted May 16, 2011 As we discussed earlier version 0.85 will be another milestone for uniGUI library. It will introduce new framework core which brings lots of architectural changes and improvements. Here is a brief list of these changes: All controls will be descendant of a common root opposed to previous releases where each Control had a different ancestor. Only implemented properties and events are published. This will avoid confusion in previous versions where lots of public and published features in VCL mode were not implemented in Web mode. Class types no longer change among Web and VCL. Now TUniButton is always a TUniButton regardless of the displayed mode. Sender parameter in event handlers always has the correct class type As a result of above changes you can safely use as and is operators. Other benefits of this new core will become manifest as framework continues to grow. For example, without new core integration of client side scripting would be very difficult. Since it contains some huge changes, incompatibility with older versions is inevitable. i.e. it will not be as easy as opening your projects and simply recompiling it. In some areas it breaks compatibility and you must go through a procedure to make your existing projects compatible with 0.85.0. Here is the receipt. Please follow these steps exactly as described in below order. Completely uninstall any previous version of uniGUI and remove uniGUI design time libraries from Delphi IDE. Download and install version 0.85.0 As always build all packages and Install the design time packages. Make a full backup of your existing project which you want to convert. Before you open the project in Delphi IDE do the following changes Locate Forms which contain TUniPageControl component. Open the associated DFM file in a Text Editor and replace all TTabSheet instances with TUniTabSheet Save the DFM file and repeat this for all Forms containing a PageControl In order to simplify next steps you can delete the DSK (Desktop) file of the related project Open the project in the IDE Open ServerModule.pas IDE will nag you for some properties that no longer exist. Ignore them and save the ServerModule.pas. For all Forms and Frames in project open them one by one. Again IDE will warn you about several properties that aren't published anymore. Press Ignore all and save the Form When you try to save modified Form, IDE may complain about some components that have incorrect class types. IDE will prompt you to correct the problem. Answer Yes to all prompts and save the Form. Repeat above steps for all Forms and Frames. Now try building the project. Compiler will generate errors for units X,Y, Z... that do not exist anymore. (e.g. UniControls, UniExtControls, ...etc.) Remove these units from Uses list and save the Form. In some of the Forms compiler may generate error for some "Unknown class type". Add UniGUIAbstractClasses to Uses list of Form and recompile the project. Now you have successfully converted your project to version 0.85 and you can run and test it in a web browser. Hopefully all converted projects should run as expected in both VCL and Web mode. If not try to localize the problem or look at the browser JS error logs. If you can not solve the problem report it here and we will work through it. 1
JasonReid Posted May 18, 2011 Posted May 18, 2011 Hi Farshad Migration of my issuetracker app to 0.86 on delphi XE starter was fairly painless thanks to the migration guide you posted, everything seems to compile and work. I managed to get ZEOSLIB installed, but its chucking AV's left right and center so I suppose I have some work to do.. Many thanks for all your hard work.
Administrators Farshad Mohajeri Posted May 18, 2011 Author Administrators Posted May 18, 2011 Hi Farshad Migration of my issuetracker app to 0.86 on delphi XE starter You have version 0.86.0? I'd really like to take a look at it.
JasonReid Posted May 18, 2011 Posted May 18, 2011 You have version 0.86.0? I'd really like to take a look at it. lol! I travelled forward in time to have a look ... I must be tired 1
JasonReid Posted May 19, 2011 Posted May 19, 2011 Hi Farshad.. I have a question .. what is the significance of "Application datamodule" and "Free Datamodule" and does this have any bearing on application migration ? In my existing app none of the ZQuery components on my datamodule will open giving a "Logic error or missing database" error, but if I create a simple test application and add an "application datamodule" it works fine. Any idea ?
Administrators Farshad Mohajeri Posted May 19, 2011 Author Administrators Posted May 19, 2011 In my existing app none of the ZQuery components on my datamodule will open giving a "Logic error or missing database" Any idea ? How this DataModule is created? Well, you can directly use MainModule if you don't need extra datamdoules. Free DataModules should be created manually at runtime.
JasonReid Posted May 19, 2011 Posted May 19, 2011 How this DataModule is created? Well, you can directly use MainModule if you don't need extra datamdoules. Free DataModules should be created manually at runtime. it was created at design-time, its been in there since version 0.71 or before.
Administrators Farshad Mohajeri Posted May 19, 2011 Author Administrators Posted May 19, 2011 it was created at design-time, its been in there since version 0.71 or before. Does it contain below lines? initialization RegisterModuleClass(TDataModule1);
JasonReid Posted May 19, 2011 Posted May 19, 2011 Does it contain below lines? initialization RegisterModuleClass(TDataModule1); Yeah thats there .. here is the unit unit DM1; interface uses SysUtils, Classes, DB, ZAbstractRODataset, ZAbstractDataset, ZDataset, ZConnection,StrUtils, IdComponent, IdTCPConnection, IdTCPClient, IdExplicitTLSClientServerBase, IdMessageClient, IdSMTPBase, IdSMTP, IdBaseComponent, IdMessage; type TDataModule1 = class(TDataModule) ISSUES_T: TZQuery; ISSUES_S: TDataSource; USERS_S: TDataSource; USERS_T: TZQuery; USERS_Tusername_calc: TStringField; IMAGES_T: TZQuery; IMAGES_S: TDataSource; IMAGE_DATA_T: TZQuery; IMAGE_DATA_S: TDataSource; IMAGES_Timage_name: TStringField; IMAGES_Timage_rn: TIntegerField; IMAGES_Tissue_rn: TIntegerField; IMAGE_DATA_Timage_data: TBlobField; IMAGE_DATA_Timage_rn: TIntegerField; IMAGE_DATA_Timage_name: TStringField; IMAGE_DATA_Tuploaded_by_rn: TIntegerField; IMAGE_DATA_Tcomments: TBlobField; IMAGE_DATA_Tissue_rn: TIntegerField; IMAGE_UPLOAD_T: TZQuery; IMAGE_UPLOAD_Timage_rn: TIntegerField; IMAGE_UPLOAD_Timage_name: TStringField; IMAGE_UPLOAD_Timage_data: TBlobField; IMAGE_UPLOAD_Tuploaded_by_rn: TIntegerField; IMAGE_UPLOAD_Tcomments: TBlobField; IMAGE_UPLOAD_Tissue_rn: TIntegerField; CHAT_T: TZQuery; CHAT_S: TDataSource; CHAT_Tchat_rn: TIntegerField; CHAT_Tusername: TStringField; CHAT_Ttime_posted: TDateTimeField; CHAT_Tmsg: TMemoField; CHAT_Tmsg_txt: TStringField; CHAT_Tuserfield: TStringField; CONTACTS_T: TZQuery; CONTACTS_S: TDataSource; CONTACTS_Tcontact_rn: TIntegerField; CONTACTS_Tcontact_name: TStringField; CONTACTS_Tcontact_company: TStringField; CONTACTS_Tcontact_phone: TStringField; CONTACTS_Tcontact_other: TStringField; CONTACTS_Tcontact_mobile: TStringField; CONTACTS_Tcontact_email: TStringField; CONTACTS_Tcontact_date: TDateTimeField; CONTACTS_Tcontactname_calc: TStringField; CONTACTS_TComments: TMemoField; IdMessage1: TIdMessage; IdSMTP1: TIdSMTP; IMAGE_DATA_Tuploaded_by: TStringField; IMAGE_UPLOAD_Tuploaded_by: TStringField; PASS_T: TZQuery; PASS_S: TDataSource; SQL2_Q: TZQuery; PASS_TPASS_RN: TIntegerField; PASS_TPASS_NAME: TStringField; PASS_TPASS_CATEGORY: TStringField; PASS_TPASS_NOTES: TMemoField; PASS_TADDED_BY_RN: TIntegerField; PASS_TDATE_ADDED: TDateField; USERS_Tuser_rn: TIntegerField; USERS_Tusername: TWideStringField; USERS_Tforename: TWideStringField; USERS_Tsurname: TWideStringField; USERS_Tdob: TDateField; USERS_Tpassword: TWideStringField; USERS_Tuseractive: TWideStringField; USERS_Tuserrole: TWideStringField; USERS_Tuseremail: TWideStringField; ISSUES_Tissue_rn: TIntegerField; ISSUES_Tappname: TWideStringField; ISSUES_Tissue_short: TWideStringField; ISSUES_Tissue_long: TBlobField; ISSUES_Tissue_date: TDateTimeField; ISSUES_Tissue_status: TWideStringField; ISSUES_Treported_by: TWideStringField; ISSUES_Tversion_no: TWideStringField; ISSUES_Tscreenshot: TBlobField; ISSUES_Tpriority: TWideStringField; ISSUES_Tnotifylist: TMemoField; ISSUES_TSOLUTION: TBlobField; ISSUES_Ttested_by: TWideStringField; ISSUES_Trequested_by: TWideStringField; ISSUES_Timageicon: TStringField; Connection1: TZConnection; SQL_Q: TZQuery; procedure ISSUES_TAfterInsert(DataSet: TDataSet); procedure ISSUES_TCalcFields(DataSet: TDataSet); procedure USERS_TCalcFields(DataSet: TDataSet); procedure CHAT_TCalcFields(DataSet: TDataSet); procedure CONTACTS_TCalcFields(DataSet: TDataSet); procedure ISSUES_TAfterPost(DataSet: TDataSet); private { Private declarations } public { Public declarations } Procedure Check_Tables; Procedure SendMail(msg_to,subj,msg : String); Function Check_User(aUser,aPassword : String):Boolean; Function Get_Role(vUser,VPassword : String):String; end; function DataModule1: TDataModule1; implementation {$R *.dfm} uses UniGUIVars, uniGUIMainModule, MainModule,main; function DataModule1: TDataModule1; begin Result := TDataModule1(UniMainModule.GetModuleInstance(TDataModule1)); end; procedure TDataModule1.CHAT_TCalcFields(DataSet: TDataSet); Var s : String; begin end; procedure TDataModule1.Check_Tables; begin { SQL_Q.SQL.Text := fMain.moCurrentSQL.Text; SQL_Q.ExecSQL; } end; function TDataModule1.Check_User(aUser, aPassword: String): Boolean; var db: string; begin //MessageDlg(dATAmODULE1.Connection1.Database, mtWarning, []); Result := True; With DataModule1.SQL_Q do Begin connection := Datamodule1.Connection1; DataModule1.Connection1.Connect; Close; SQL.Clear; Sql.Add('select * from users'); sql.Add('where upper(username) = :un'); sql.Add('and upper(password) = :pw'); paramByname('un').Value := uppercase(aUser); paramByname('pw').Value := uppercase(aPassword); Open; If isEmpty then Result := False else Begin fMain.USERNAME := fieldbyname('username').AsString; fMain.user_email := fieldbyname('useremail').AsString; End; End; end; procedure TDataModule1.CONTACTS_TCalcFields(DataSet: TDataSet); begin CONTACTS_TContactname_calc.Value := CONTACTS_TContact_name.AsString + '(' + CONTACTS_TContact_Company.AsString + ')'; end; function TDataModule1.Get_Role(vUser, VPassword: String): String; begin Result := 'UnKnown role'; With DataModule1.SQL_Q do Begin SQL.Clear; Sql.Add('select * from users'); sql.Add('where Upper(username) = :un'); sql.Add('and Upper(password) = :pw'); paramByname('un').Value := Uppercase(vUser); paramByname('pw').Value := UpperCase(vPassword); Open; If RecordCount > 0 then Result := FieldByName('userrole').AsString; End; end; procedure TDataModule1.ISSUES_TAfterInsert(DataSet: TDataSet); begin ISSUES_TIssue_Date.Value := Now; ISSUES_TIssue_Status.Value := 'Reported'; ISSUES_TReported_By.Value := fMain.USERNAME; end; procedure TDataModule1.ISSUES_TAfterPost(DataSet: TDataSet); begin If ISSUES_Tnotifylist.AsString <> '' then SendMail( ISSUES_Tnotifylist.AsString, 'Issue #' + ISSUES_Tissue_rn.AsString + ' has been updated.', 'Issue Project : ' + Issues_Tappname.AsString + #13#10 + 'Project version : ' + Issues_TVersion_no.AsString + #13#10 + 'Issue Subject : ' + Issues_TIssue_Short.AsString + #13#10 + 'Issue Status : ' + Issues_TIssue_Status.AsString + #13#10 + DataModule1.ISSUES_Tissue_long.AsString ); end; procedure TDataModule1.ISSUES_TCalcFields(DataSet: TDataSet); Var aStatus : String; begin aStatus := Uppercase(ISSUES_TISSUE_STATUS.Value); *removed* end; procedure TDataModule1.SendMail(msg_to,subj,msg: String); begin *removed* end; procedure TDataModule1.USERS_TCalcFields(DataSet: TDataSet); begin USERS_Tusername_calc.Value := USERS_Tforename.AsString + ' ' + USERS_Tsurname.AsString + '(' + USERS_Tusername.AsString + ')'; end; initialization RegisterModuleClass(TDataModule1); end.
Administrators Farshad Mohajeri Posted May 19, 2011 Author Administrators Posted May 19, 2011 Then problem is somewhere else. Does app work in VCL mode?
JasonReid Posted May 19, 2011 Posted May 19, 2011 Then problem is somewhere else. Does app work in VCL mode? no, same problem..
thecrgrt Posted May 19, 2011 Posted May 19, 2011 no, same problem.. what does it mean about below code? Result := True; With DataModule1.SQL_Q do Begin connection := Datamodule1.Connection1; DataModule1.Connection1.Connect; IMO, you should remove "DataModule1" from this code.
Administrators Farshad Mohajeri Posted May 19, 2011 Author Administrators Posted May 19, 2011 no, same problem.. If it doesn't work in VCL mode then you must check logic and connection between DB components. Maybe some internal connections are gone.
Recommended Posts