Jump to content

Recommended Posts

  • Administrators
Posted

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:

 

  1. All controls will be descendant of a common root opposed to previous releases where each Control had a different ancestor.
  2. 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.
  3. Class types no longer change among Web and VCL. Now TUniButton is always a TUniButton regardless of the displayed mode.
  4. Sender parameter in event handlers always has the correct class type
  5. 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.

 

  1. Completely uninstall any previous version of uniGUI and remove uniGUI design time libraries from Delphi IDE.
  2. Download and install version 0.85.0
  3. As always build all packages and Install the design time packages.
  4. Make a full backup of your existing project which you want to convert.
  5. Before you open the project in Delphi IDE do the following changes
  6. Locate Forms which contain TUniPageControl component.
  7. Open the associated DFM file in a Text Editor and replace all TTabSheet instances with TUniTabSheet
  8. Save the DFM file and repeat this for all Forms containing a PageControl
  9. In order to simplify next steps you can delete the DSK (Desktop) file of the related project
  10. Open the project in the IDE
  11. Open ServerModule.pas
  12. IDE will nag you for some properties that no longer exist. Ignore them and save the ServerModule.pas.
  13. 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
  14. 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.
  15. Repeat above steps for all Forms and Frames.
  16. Now try building the project.
  17. 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.
  18. 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.

  • Upvote 1
Posted

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.

Posted

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
Posted

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.

Posted

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.

Posted

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.

Posted

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.

×
×
  • Create New...