Jump to content

vbdavie

uniGUI Subscriber
  • Posts

    178
  • Joined

  • Last visited

  • Days Won

    6

Posts posted by vbdavie

  1. I see "ClientEvents". It seems that maybe this is where you can assign some javascript code to particular events. And that you can use the EXT trapped events or the UniGui trapped events.

     

    But what does ENABLED=TRUE do? This is just turn on or off the scripting logic?

     

    Is see...

    MonitoredKeys

       Enabled

       KeyEnableAll

       KeyHandleAll

       Keys

     

    What do the 4 properties of MonitoredKeys actually do?

     

    I see...

    NavigateKeys

       Cycle

       Enabled

       HandleTabs

     

    What do these settings do? I know the handletabs seemed to allow the form to utilize the tab functionality.

     

    RTL:   What does this do?

     

    ScreenMask:

       Enabled

       Message

       ShowMessage

       Target

       WaitData

     

    Could you explain what these do? I see talk about waitdata all over the place, it's not clear. And please be clear about "Target" as I can't even image what that does.

     

    Thanks

     

    Davie

  2. I am getting further in having my app actually do something useful. I have 5 questions that are probably simple to answer, but since I'm a NEWBIE, I don't know the answers to them.

    QUESTION #1:
    I see two ways to create forms...
        1. MyForm := TUniForm5.Create(UniApplication)
        2. Result := TFormAnchor(UniMainModule.GetFormInstance(TFormAnchor));

    Since method #2 is more commonly used everywhere, why do #1? Which is better?

    I also noticed that a bunch of forms have this sort of thing at the end...
       initialization
          RegisterClass(TUniMaskEdit);

    I presume this is so that the...
       FrC := TUniFrameClass(FindClass(FClassName));
    line of code will find the class and be able to instantiate it onto a Tab in the page control, when the user clicks on the TreeView node?

    QUESTION #2:
    I noticed that you mentioned that the SHOW/SHOWMODAL should be in the same procedure that creates the form object, in an earlier post.

    Why should it be shown in the same event that creates the form object?

    QUESTION #3:
    What makes a form a "FreeForm" ? The forum said in an earlier post...
         Free form should be created in code manually. It is not managed by framework.
    What does that mean?

    QUESTION #4:
    Why is there a unitTimer? is TTimer not any good?

     

    QUESTION #5:
    From an earlie post, I saw...

    For example several times I've seen that developers do things like below:

    procedure TMainForm.UniEdit1KeyDown(Sender: TObject; var Key: Word;  Shift: TShiftState);
    begin
      if Key = 13 then
      begin
      // do somthing
      end;
    end;
    Which doesn't make sense at all when you deploy your app on the web. It would make sense only in a gigabit LAN, but certainly makes no sense on the internet.

    I do this EXACT thing when the user presses the ESC key so I can exit the form. Why is that a bad idea? How else would I close the form when the user presses the ESC key?

     

  3. I've read as many posts as I could find and it seems that all the comments indicate to use the uniGUI version of the datamodule AND NOT the TDataModule that comes with standard Delphi apps.

     

    I have a delphi desktop app that does a LOT (hundreds of data manipulation functions) of DB functions on my DB.

     

    We need to create a Web version of the app and I thought that if I could "Re-Use" my datamodule, that would save so so so much time. It appears that in uniGUI EXE mode, I have NO ISSUES at all. I was estatic<happy>, and so I tested it in the DLL(ASAPI) mode and it just locks up or doesn't work at all.

     

    I tried creating the datamodule a few different ways:

        1.  Application.CreateForm(TFDataModule,FDataModule);

        2.  FDataModule:=TFDataModule.Create(Nil);
    Boths of these do not work in the DLL mode. What is it about the TDataModule that makes it not work ONLY IN DLL mode? It works in my Desktop app and in the UniGUI EXE mode.

     

    YET another difference between EXE and DLL mode :(

     

    Is there a good solution so that I can RE-USE my code between my desktop app and my uniGUI DLL?

     

    Thanks very much

    Davie

    P.S. What is the RTL property on forms?

     

  4. I have some code that LOCKS UP the DLL when running is ISAPI mode. Here's my code....

     

    Function CreateShortCut_Lnk(RealFile,Parms,ShortCutName,LpszDescStr:AnsiString):Boolean;
    Var
        psl:IShellLink;
        ppf:IPersistFile;
        HRes:HRESULT;
        wsz:PWideChar; {Max_Path}
        LpszParms,LpszPathObj,LpszPathLink,LpszDesc:Array[0..Max_Path]
    {$IFDEF VER120}
            Of Char;
    {$ELSE}
            Of WideChar;
    {$ENDIF}
    Begin
    TranslateForVista(ShortCutName);
    StrPCopy(LpszPathObj,RealFile);
    StrPCopy(LpszPathLink,ShortCutName);
    StrPCopy(LpszDesc,LpszDescStr);
    StrPCopy(LpszParms,Parms);
    {
    CoInitialize(Nil);
    }
    GetMem(Wsz,Max_Path*SizeOf(WideChar));
    Hres:=CoCreateInstance(CLSID_ShellLink,
                           Nil,
                           CLSCTX_INPROC_SERVER,
    {$IFDEF VER120}
                           IID_IShellLinkA,
    {$ELSE}
                           IID_IShellLinkW,
    {$ENDIF}
                           psl);
    If (SUCCEEDED(Hres)) Then
       Begin
       psl.SetPath(lpszPathObj);            -      Seems to lock up on this line
       psl.SetDescription(lpszDesc);
       psl.SetArguments(lpszParms);
       Hres:=psl.QueryInterface(IPersistFile,ppf);
       if (SUCCEEDED(Hres)) Then
          Begin
          MultiByteToWideChar(CP_ACP,
                              0,
                              PAnsiChar(AnsiString(lpszPathLink)),
                              -1,
                              wsz,
                              MAX_PATH);
          Hres:=ppf.Save(wsz, TRUE);
          End;
       End;
    FreeMem(Wsz,Max_Path*SizeOf(WideChar));
    {
    CoUnInitialize;
    }
    Result:=SUCCEEDED(Hres);
    End;

     

    This basically allows me to create a shortcut file easily. I call it like this....

     

    CreateShortCut_Lnk('TestShortCut.txt','',ExtractFilePath(ApplicationDLLName)+'TestShortCut.lnk','You can delete this file');

     

    This allows me to create a test shortcut file that points to "TestShortCut.TXT".

     

    When done during the initialization phase of a normal VCL program, it fixes a bug that VISTA has with memory leaks. Anyway, during the DLL ASAPI mode, when it hits the RED line, it basically messes up the uniGUI system. It make it lock up and stop servicing the other apps in the application pool. If I run the uniGUI in EXE mode, then it works fine. It's just in DLL mode that it hangs. What's wierd is that when I take out the call to CreateShortCut_Lnk in my INITIALIZATION code of my unit, and INSTEAD put the code on a buttonClick event, IT WORKS FINE and creates the shortcut and doesn't lock up :)

     

    I think this is some sort of COM stuff, so maybe that's the deal.

    HINT: If I DO NOT put it in the initialization section of my unit, and simply call it from a button click, then it WORKS. Very wierd.
     

    Yet ANOTHER difference between the EXE mode and the DLL mode :)

     

    Any ideas why the lock up?

     

    Davie

  5. Thanks, but since I mentioned that I am new to the "web" way of thinking, AND new to uniGUI, your 8 word response doesn't help me at all. Sorry for being new to all this. I'm sure a seasoned person would make good use of that answer.

     

    The only thing that comes "close" to what I want is the DialogAnonymousCallBack.pas file. It shows some nested dialogs. But again, the examples DO NOT show how I can use variables that I set depending on the dialog answers in the code logic at the end of my procedure. The sample code looks like this...

     

    procedure TUniDialogAnonymousCallBack.UniButton6Click(Sender: TObject);
    begin
    {$ifdef COMPILER_12_UP}
      MessageDlg('Dialog3', mtConfirmation, mbYesNo,
        procedure(Sender: TComponent; Res: Integer)
        begin
          case Res of
            mrYes :
              MessageDlg('Dialog4', mtConfirmation, mbYesNo,
                procedure(Sender: TComponent; Res: Integer)
                begin
                  case Res of
                    mrYes : UniMemo1.Lines.Add('DResult: YES');
                    mrNo : UniMemo1.Lines.Add('DResult: NO');
                  end;
                end
              );
            mrNo : UniMemo1.Lines.Add('DResult: NO');
          end;
        end
      );
    {$else}
      ShowMessage('This feature is NOT available in this version of Delphi');
    {$endif}
    end;

     

    It's funny, I think the coders forgot the word "NOT" in the message :) I see the same mistake in may places and units, I wonder if I am missing something. Hmmm.

     

    Anyway, the example does NOT allow me to have local variables in the "uniButton6Click" method that are SET by the callback methods :blink2:

    Also, since the messagedlg NEEDS to exit the uniButton6Click event right away, there's no chance for me to do anything with variables that I may have set. Look at my example again and you will see that once I have captured all the answers from the dialogs, I THEN use them to make some sort of database update.

     

    Begin

    ....

    // nested dialogs to obtain a series of answers...(IAmStupid, IRA_LotsOfMoney)

    ...

    // Logic to take those answers and then store them into the database

    If IAmStupid Then
       DoSomeStupidLogic
    If IRA_LotsOfMoney Then
       DoOtherLogic
    // Now save the data
    SaveMySettings(IRA_LotsOfMoney,IAmStupid);
    End;

     

     

    Also, the nested example doesn't indicate how to properly CALL the particular method. My example pseudo-code had this....

     

    // My function that ends up calling the GetProperAge procedure
    Procedure SomeFunction;
    Var
      Age:Integer;
    Begin
    ...
    GetProperAge(Age);
    ...
    more logic
    ...
    End;

     

     

    As you can see, my procedure called "SomeFunction" does some stuff and THEN CALLS GetProperAge (which has nested dialogs) and then does some more stuff. It is my understanding that if I call the GetProperAge or any method that contains nested dialogs, that the CALLING method should NOT have ANY logic after that calling statement. IE: It needs to exit right away so all the communication to the browser can do it's thing. That means where I have "more logic", should not be there according to the way I understand it. But yet my logic flow chart on paper and in my brain, indicates that after I call GetProperAge, I need to then do some stuff <more logic> SOOoooo, how do I accomplish this?

     

    I could be wrong. But I don't think so.

     

    Davie

  6. With the understanding that there is NO SUCH THING as a "blocking" modal form,  How would I turn my windows logic into uniGUI logic<web logic> ?

     

    This is my pseudo-code that I would like to transform into using NON-BLOCKING web-ified code. Please keep in mind that I have only used this system for about 20 hours, so I'm pretty much a NEWBIE at this. 40 years experience at programing and 30 years with pascal and 16 years with Delphi.

     

    Procedure GetProperAge(Var Age:Integer);
    Var
      IRA:Boolean;
      IRA_LotsOfMoney:Boolean;
      IAmStupid:Boolean;
    Begin
    Age:=ReadAge;
    IAmStupid:=False;
    IRA_LotsOfMoney:=False;
    If Age>70 Then
       Begin
       If MessageDlg('Are you taking money from IRA?',[mbYes,mbNo]) = mrYes Then
          Begin
          IRA:=True;
          If MessageDlg('Do you take a lot of money?',[mbYes,mbNo]) = mrYes Then
             IRA_LotsOfMoney:=True
          End
       Else
          Begin
          IRA:=False;
          If MessageDlg('Are you stupid?',[mbYes,mbNo]) = mrYes Then
             IAmStupid:=True;
          End;
       End;
    If IAmStupid Then
       DoSomeStupidLogic
    If IRA_LotsOfMoney Then
       DoOtherLogic
    // Now save the data
    SaveMySettings(IRA_LotsOfMoney,IAmStupid);
    End;

     

    // My function that ends up calling the GetProperAge procedure
    Procedure SomeFunction;
    Var
      Age:Integer;
    Begin
    ...
    GetProperAge(Age);
    ...
    more logic
    ...
    End;

     

    What would the web-ified code look like. When going from non object oriented code to object oriented code, there were key "concepts" that helped to understand it. When going from DOS based code, where the program would monitor keystrokes, and then going to event driven windows programming, there were key "concepts" that helped to understand it.

     

    I am not stupid, but I must admit, I am having a heck of a time trying to visualize how to convert this simple code over to the web-ified version that would work in the uniGUI system :(

     

    Any help is much appreciated.

     

    Thanks

    Davie

    • Happy 1
  7. Ah, so basically what I see as the advantage is that you don't have to have code in your program to EXPORT TO PDF. It looks like you just print to the server and the server keeps the data in a compressed internal FR3 format and then you tell the server that you want a paricular report and you tell it you want the PDF FORMAT type and poof, the server dishes it up to you? Is that the benefit?

     

    Thanks

    Davie

  8. Thanks for your reply, I got my sample project working, but was wondering if FastReports was thread-safe.

     

    My sample project just reads in a few lines from DB and displays some detail lines and a couple of charts. Then in code, it composes it and then exports to PDF and then loads the PDF into the URLFrame component.

     

    How is that DIFFERENT from what YOU are doing? Your way seems more complicated with more steps involved. Mine is like....

    button to VIEW report...

    procedure TFormRep1.ButtonViewClick(Sender: TObject);
    begin
       MainForm.DwnRepoFile:=False;
       QryCity.Open;
       DataFrTools.MyFrxShow(frxReport1);
       QryCity.Close;
    end;

    function to do the displaying. Stuff it into a URLFrame

    procedure TDataFrTools.MyFrxShow(frxReport: TfrxReport);
    var
       fn:String;
       FormUrlView1: TFormUrlView;
    begin
       fn:= 'R-' +FormatDateTime('hhmmss.zzz', Now()) +'.pdf'; // Create a unique name for report.
       frxReport.PrintOptions.ShowDialog := False;
       frxReport.ShowProgress:=false;
       frxReport.PrintOptions.ShowDialog:=false;
       frxReport.EngineOptions.SilentMode:=True;
       frxPDFExport1.Background:=True;
       frxPDFExport1.ShowProgress:=False;
       frxPDFExport1.ShowDialog:=False;
       frxPDFExport1.FileName := UniServerModule.LocalCachePath +fn;
       frxPDFExport1.DefaultPath := '';
       if Mainform.WebMode then begin
          frxReport.PrepareReport(); // Create Report
          frxReport.Export(frxPDFExport1); // Export Report
          if MainForm.DwnRepoFile then begin
             UniSession.SendFile(UniServerModule.LocalCachePath +fn, fn);
          end else begin
             FormUrlView1:=TFormUrlView.Create(UniApplication);
             FormUrlView1.URLFrame.URL := UniServerModule.LocalCacheURL +fn; // Displayed on UniURLFrame
             FormUrlView1.Show;
          end;
       end else begin
          frxReport.ShowReport();
       end;
    end;
     

     

    And that's pretty much it.

     

    Thanks

    Davie

  9. I've seen several posts here that are old referring to FastReports.

     

    Since the preview window of fast reports is for VCL, does that mean this will NOT WORK for uniGUI?

     

    If it DOES work, is there a decent demo? I downloaded the corrected RAR file demo, but it doesn't appear to load. I will have to see about dependencies.

     

    Anyway, the demo looks like it turns off the visual preview mode and uses an internal processes of the report and then sticks it into a FormURLView type of framed component.

     

    Is that the correct way?

     

    Is Fast Reports thread safe? I'm having trouble understanding what types of components I can use. IE: If fast reports used some sort of global variables, then it would not be thread-safe. It used to be that a lot of the graphics objects in Delphi were not thread-safe. So, since the Fast Reports does a lot of graphics and charts etc.... I am concerned that it's a disaster waiting to happen. Hmmmm.

     

    On a minor note: When you say run the uiGUI in VCL mode, does that mean run it right on your desktop WITHOUT a browser? Since I couldn't find or get that feature, can I presume that that feature is turned off for Trial Versions?

     

    Thanks

    Davie

  10. I just downloaded the TRIAL version of this after looking at many other products for Delphi. It seems to me that this product is the only one I've seen (other than Raudus), that gives you the ability to use the Delphi COMPILER and the Delphi IDE and to actually produce code that looks decent on the screen.

     

    That said, I like the product. I was able to install and get the demos running very fast.

     

    Problem: I was able to get what I wanted done very fast and I thought I would try the STRESS TOOL to test my code. I went to look for it and couldn't find it. Your skimpy online documentation refers to this path....  ..\uniGui\Utils\StressTestTool folder

     

    I do NOT see this folder anywhere:(

     

    So, what am I missing? Did I do something wrong? I really wanted to run the stress test to see the results.

     

    Nice product.

     

    Davie

×
×
  • Create New...