Jump to content

sobakava

Members
  • Posts

    77
  • Joined

  • Last visited

  • Days Won

    7

Posts posted by sobakava

  1. Use a query component (instead a table component) and an appropriate SQL Statement (which returns the needed 100 records).

    Also be sure your seach columns are indexed columns in the databse.

     

    Thanks.

     

    I have just realized that, 

      form_dm.MyTable8.Active := true;

    takes a lot of time. If I active the dataset at startup, of the application, the graph appears fast.  But the startup of the application takes time.

     

    I'm using a server on Contabo running MySQL and MyDAC.

     

    What can cause this?

  2. I'm trying to plot some data (real number) from my MySQL database using Highchart.

     

     

    This is how the database read routine looks like. I'm interested in showing last 100 data points. 

     

    So, I'm activating the table, apply a filter to select only some specific data, then get the number of records found matching to the filter.

     

    Then, I'm moving database pointer to record number (total_records  - 100)

     

    And in a loop, I'm reading the values. Then I'm passing this mydata[] serie to chart plot function.

     

    This loop runs for only 100 records but it is incredibly slow. (Loop itself takes ~10 seconds)

     

    How can I optimize this?

     

    ( I tried to fill the mydata with random numbers in a loop instead of reading them from database, it is almost instantaneous.)

      form_dm.MyTable8.Active := true;
    
    
      form_dm.MyTable8.Filtered := false;
      form_dm.MyTable8.Filter := '(flt_ddt_id = 22)';
      form_dm.MyTable8.Filtered := true;
      form_dm.MyTable8.First;
      hm1_cnt := form_dm.MyTable8.RecordCount;
    
    
      if hm1_cnt > 100 then
         form_dm.MyTable8.RecNo := hm1_cnt - 100;
    
    
      if hm1_cnt > 0  then
      begin
          tx := 0;
          while ( not form_dm.MyTable8.Eof ) do
          begin
    
                tx := tx + 1;
                mydata[ tx ] := form_dm.MyTable8.FieldByName('flt_data').AsFloat;
                form_dm.MyTable8.Next;
    
          end;
      end;

     

  3. Merhaba öncelikle cevaplar için teşekkür ederim.

     

    @sobakava kızmanıza gerek yok  :D anladım demek isteğinizi.

     

    Siz diyorsunuzki; javascript yada java ile yapman lazım! Bende o diller hiç bilmiyorum diyorum sanırım ayrıştığımız nokta bu.

     

    Bu yüzden ilgili makinalarda bir servis çalıştırarak bu işi çözmeyi planlıyorum.

     

    Teşekkürler.

     

    Selamlar. Kızdığım yok, eğer öyle anlaşıldıysa özür dilerim. Ben de Javascript'e halim değilim. Ama yolladığım linklere bakarsanız, bir Win32 makinede servis çalıştıracak yetenekte birinin, biraz inceleyip okuyarak kolayca altından kalkabileceği bir iş gibi gözüktü bana.

     

    Projenizde başarılar dilerim.

  4. chrome.serial.... diyebilmem için Uses kısmına ne eklemem gerekiyor acaba?

     

     

    Daha önce de yazdım, bu işin unigui veya Delphi'de kullandığınız seri port bileşenleri ile zerre alakası yok. Hatta bunlar dünyada hiç yokmuş gibi düşünün. Sadece JavaScript ve Notepad var. Javascript kullanmanız gerekli veya Java applet'i kullanabilirsiniz.

     

     

    Javascript için bunu incelemenizi öneririm. 

    https://github.com/garrows/browser-serialport

     

     

    Java için:

    https://code.google.com/p/java-simple-serial-connector/

     

     

    Javascript ile yapılmış kütüphaneyi kullanarak bir HTML yapıp, browser'ı çalıştıran bilgisayarın seri portuna erişim sağlayabilirsiniz. Tekrar ediyorum bunun UniGui ile alakası yok. HTML dosyasını, kullanıcı ister flash diskten dosyaya çift tıklarayarak açsın ister bir TUNIHTMLFrame içinden erişsin... İşi yapan Javascript ve "yerel" browser.

  5. I have created some UniGUI components for my project, in that way I can re-use the visual objects that I have implemented at ease. I just wanted to share my way of doing this with you guys. Any comments, technical critiques are welcome.

     

     

     

     

     

     

    1. Creating the Component Package

     

    Since I have more than one custom components, I prefer to keep them in a Deplhi Package instead of individual self registering Delphi units. So we start with creating a component package in Delphi.

     

    File > New > Other > Delphi Projects > Package

     

     

    Kawef.jpg

     

     

     

     

     

    2. Adding a TUNIFrame to The Package

     

    As the base of the components, I'm using TUNIFrame. We are going to add a TUNIFrame first.

     

    File > New > Other > Delphi Projects > uniGUI for Delphi > Frame

     

     

    tIGfE.jpg

     

     

     

     

     

    3. Adding Child Components

     

    Decorate your new TUNIFrame with existing UniGUI components as you wish. In this example, my frame looks like the picture below.

     

     

    bDpF2.jpg

     

     

     

     

     

     

    I'm also renaming the frame. In this case the name is 'frame_myunipanel'. Don't forget to save unit files to disk. I named the files as unit_myunipanel.

     

    The visual object tree is shown below:

     

    YZyyV.jpg

     

     

     

     

     

     

     

    And this is how the project tree looks like. I saved package with the name 'package_myunipanel'. I have only one unit; unit_myunipanel in the project tree.

     

     

    vPzeV.jpg

     

     

    Our package has some dependencies:

     

    Right click on package_myunipanel.bpl > View Source  from the pop-up menu.

     

     

    requires
      rtl,
      vcl,
      vclimg,
      dbrtl,
      soaprtl,
      vcldb,
      uIndy22,
      uniTools22,
      uniGUI22Core,
      uniGUI22,
      designide,
      uniGUI22Chart;
    
    
    contains
      unit_reg in 'unit_reg.pas',
      unit_myunipanel in 'unit_myunipanel.pas' {frame_myunipanel: TUniFrame};

     

    4. Adding The Registrar Unit To The Project

     

    At some point, we should tell Delphi to register our new component. We can do this in a plain Delphi unit.

     

    File > New > Other > Delphi Projects > Delphi Files > Unit

     

    MV5Sx.jpg

     

     

     

     

    Now we have a new unit in the package. I'm saving this unit as 'unit_reg.pas'. This is the final appearance of our package tree:

     

    HCvAD.jpg

     

     

     

     

    Here is the tricky part, the registration. This is the unit_reg.pas. 

     

    unit unit_reg;
    
    
    interface
    uses uniGUIFrame;
    
    
    procedure Register;
    
    
    implementation
    
    
    uses
      Classes,
      TreeIntf,
      unit_myunipanel;
    type
      TFrameClass = class of TUniFrame;
    
    
    procedure RegisterFramesAsComponents(const Page: string; const FrameClasses: array of TFrameClass);
    var
      FrameClass: TFrameClass;
    begin
      for FrameClass in FrameClasses do
      begin
        RegisterComponents(Page, [FrameClass]);
        RegisterSprigType(FrameClass, TComponentSprig);
      end;
    end;
    
    
    procedure Register;
    begin
      RegisterFramesAsComponents('UniGUI 3rd Party', [Tframe_myunipanel]);
    
    
    end;
    
    
    end.

     

     

    I did not add any published properties or methods to my panel yet. This is how the unit_myunipanel looks like. You can add properties and methods to your component just like you do with VCL units.

    unit unit_myunipanel;
    
    
    interface
    
    
    uses
      Windows, Messages, SysUtils, Variants, Classes, Graphics,
      Controls, Forms, Dialogs, uniGUITypes, uniGUIAbstractClasses,
      uniGUIClasses, uniGUIFrame, uniTrackBar, uniLabel, uniEdit, uniGUIBaseClasses, uniPanel;
    
    
    type
      Tframe_myunipanel = class(TUniFrame)
        UniContainerPanel1: TUniContainerPanel;
        UniEdit1: TUniEdit;
        UniLabel1: TUniLabel;
        UniTrackBar1: TUniTrackBar;
      private
        { Private declarations }
      public
        { Public declarations }
      end;
    
    
    implementation
    
    
    {$R *.dfm}
    
    
    end.

    4. Installing the Component

     

     

    Right click on package_myunipanel.bpl > Install

     

     

    Voila! We are good to go.
     
    jyuzM.jpg
     
     
    Now you can add this component to your UniGUI projects.
     
     
     
     
    8TEX5.jpg
     
     
     
    PS: TreeIntf.pas is located in here:
     
    "c:\Program Files (x86)\Embarcadero\Studio\16.0\source\ToolsAPI\TreeIntf.pas" 
     
    If your IDE can't find it, you might need to add it to your search path.
    • Like 2
    • Upvote 6
  6. I understand.

     

    I resolved this issue by mapping Delphi's clNone color to web Transparent color. This will work for all components with Color property.

     

    This feature will be available in next build.

     

    Now my drop shadow works perfectly. Thanks for the new version Farshad. (0.99.80.1227)

    • Upvote 1
  7. DNito.jpg

     

    Well, my problem is turned into "How to make tooltips appear top of every other element in the page?"

     

    I decided that I can place my TUnipanels into TuniContainerPanels and add Javascript to TuniContainerPanel to activate this kind of fancy looking tooltips.

     

    But if the TUniContainerpanel is a child of another one, the tooltip becomes clipped by the surrounding panel.

  8. PS:

     

    This works with TUnicontainerPanel perfecly, but not with TUniPanel.

    function added(sender, container, pos, eOpts)
    {
      var html=sender.id;
    
      Ext.Function.defer(function(){
       document.getElementById(html).setAttribute('data-hint', 'hello');
       document.getElementById(html).classList.add('hint--bottom');
      }, 100, this, []);
  9. I have manually deleted following during the runtime:  (using Chrome's inspect elements feature)

     

    top parent div, (013_id)

    body div  (013_id-body)

    inner div  (013_id-innerCt)

     

    and left the outerCt with the hint attributers and class.

     

     

     

    Then the hint started to appear as below. How to do it properly with Unigui / Extjs?

     

     

    KMsx1.jpg

  10. Thanks Erich,

     

    Actually it did work. Thanks But I still can't see the tooltip:

     

    This is the Extevents / added of my panel that I want to add tooltip.

     

    function added(sender, container, pos, eOpts)
    {
      var html=sender.id;
    
      Ext.Function.defer(function(){
       document.getElementById(html).setAttribute('data-hint', 'hello');
       document.getElementById(html).classList.add('hint--bottom');
      }, 100, this, []);

    this is how the result looks like:

    c8uvb.jpg

     

     

     

    The result seems like I wanted it to be:

     

     

    <div class="x-panel x-abs-layout-item x-panel-default hint--bottom" style="left:96px;top:56px;width:256px;height:128px;" id="O13_id" data-hint="hello">

     

        <div id="O13_id-body" class="x-panel-body x-panel-body-default x-abs-layout-ct x-panel-body-default" role="presentation" style="width: 256px; height: 128px; left: 0px; top: 0px;">

          <span id="O13_id-outerCt" style="display: table; width: 100%; table-layout: fixed; height: 100%;" role="presentation">

             <div id="O13_id-innerCt" style="display:table-cell;height:100%;vertical-align:top;" class="" role="presentation">

                 <table border="0" width="100%" height="100%"><tbody><tr>

                    <td id="O13_id_td" style="font:11px Tahoma;color:#000000;text-align:center">UniPanel1</td></tr></tbody>

                  </table>

             </div>

          </span>

        </div>

     

     

    but only a small piece of arrow appears for a fraction of time and disappears.

     

     

     

    1y84r.jpg

     

     

     

    I have also tried to add this class and attribute to body div instead of the top level parent. The visual result is the same.

     

    function added(sender, container, pos, eOpts)
    {
      var html=sender.id;
      html=html+'-body';
      Ext.Function.defer(function(){
       document.getElementById(html).setAttribute('data-hint', 'hello');
       document.getElementById(html).classList.add('hint--bottom');
      }, 100, this, []);
    
    
    }

     

    xAKG2.jpg

     

     

     

     

  11. What does Transparent mean here? Same color as background?

     

    I'm not sure what Stressman asks for but with "transparent", I mean a TUniframe with background is not filled but it acts like fully transparent rectange that holds child component.s

     

    It's like bodyStyle: 'background:transparent;".

     

     

    The reason I started to think I need this kind of feature, I've a TUniHTMLFrame placed in a TUniFrame. I have added Drop-shadow effect using CSS to TUniHTMLframe. 

     

    So it works, I can see the shadow effect on the TuniHtmlFrame but the components behind(?) them looks strange since the frame itself is also solid.

     

    This is the topic:

    http://forums.unigui.com/index.php?/topic/5948-how-to-create-drop-shadow-for-a-panel-or-htmlframe/

     

     

     

    I just thought, if the TUniFrame was transparent, I could see the drop-shadow effect on the components of main from. (light blue area)

     

     

    05xdF.jpg

     

     

     

    This is the how the components look like.

     

     

    7Ziah.jpg

  12. I have accidentally(!) fixed this:

     

    For UniHTMLFrame:

    function added(sender, container, pos, eOpts)
    {
        sender.addBodyCls('filter-drop-shadow');
        sender.addCls('myUnselectable');  
    
      var html=sender.id;
      html=html+'-body';
      Ext.Function.defer(function(){
       document.getElementById(html).setAttribute('style', 'background-color:transparent !important');
       }, 100, this, []);
              
    }

    This is the CSS :

          '.filter-drop-shadow {                                           ' +
          '    padding: 8px       !important;                              ' +
         '-webkit-filter: drop-shadow(1px 1px 6px rgba(0,0,0,.5))!important;'+
          '-moz-filter: drop-shadow(1px 1px 6px rgba(0,0,0,.5))!important; ' +
          '-ms-filter: drop-shadow(1px 1px 6px rgba(0,0,0,.5))!important;  ' +
          '-o-filter: drop-shadow(1px 1px 6px rgba(0,0,0,.5))!important;   ' +
          'filter: drop-shadow(1px 1px 6px rgba(0,0,0,.5))!important;      ' +
          '}                                                               ' +

    sXAKA.jpg

     

    My problem is the transparency now. This graph actually lays in a TUniFrame.

     

     

    Uniframe >> UniContainerPanel >> UniHTMLFrame

     

    The Drop Shadow drops on Uniframe  which is NOT transparent.

     

    How can I make UniFrame transparent?  ( It has been asked in the forum but not answered)

     

    Actually in general, how can I access UniFrame's HTML/CSS properties? There is no UniEvents for the Frame.

     

     

     

     

×
×
  • Create New...