Jump to content

stiaan

uniGUI Subscriber
  • Posts

    120
  • Joined

  • Last visited

  • Days Won

    9

Posts posted by stiaan

  1. Hi

     

    Can anybody please assist:

    I'm busy developing a UniGUI system that captures the realtime output of a console application and is then displayed it in a TUniHTMLMemo control. I need to be able to scroll as the text comes in from the console app.

     

    The application successfully captures the output, but I need to scroll and show the latest line.

     

    Much appreciated!

     

    Regards

    Stiaan

  2. Hi Farshad

     

    We are interested in buying the UniGUI complete Pro version. The questions i have is:

    1. Do we get all the source code? For UniGUI and UniGui Mobile? (Sorry, but I could have missed this info.)

    2. How many users can use UniGUI for development?

    3. The ExtJS license, is that a company license? How many user can user ExtJS and ExtJS Mobile?

     

    Your support is much appreciated!

     

    Regards

    Stiaan

     

     

  3. Hi

     

    Here is some code that works with TTREEVIEW, which will probably work with TuniTreeView. It saves data to a INI file, which is a text file with some structure. Drag-and-drop also supported.

    unit MainForm;

    interface

    uses
      Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
      Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ComCtrls, Vcl.StdCtrls, Vcl.ExtCtrls;

    type
      TForm1 = class(TForm)
        TreeView1: TTreeView;
        Panel1: TPanel;
        Button1: TButton;
        Button2: TButton;
        procedure FormCreate(Sender: TObject);
        procedure FormDestroy(Sender: TObject);
        procedure Button2Click(Sender: TObject);
        procedure Button1Click(Sender: TObject);
        procedure TreeView1DragOver(Sender, Source: TObject; X, Y: Integer;
          State: TDragState; var Accept: Boolean);
        procedure TreeView1DragDrop(Sender, Source: TObject; X, Y: Integer);
      private
        procedure ReloadTree;
      public
        { Public declarations }
      end;

      TTreeNodeData = record
        GUID : String;
        Parent : String;
        Mapped : Boolean;
      end;
      PTreeNodeData = ^TTreeNodeData;

    var
      Form1: TForm1;

    implementation

    {$R *.dfm}

    Uses
      INIFiles;

    procedure TForm1.Button1Click(Sender: TObject);
    begin
      ReloadTree;
      ShowMessage( 'Reloaded!' );
    end;

    procedure TForm1.Button2Click(Sender: TObject);
    var
      INI : TMemINIFile;
      i : integer;
    begin
      DeleteFile( 'tree.ini' );
      INI := TMemINIFile.Create( 'tree.ini' );

      for i := 0 to TreeView1.Items.Count - 1 do
      begin
        INI.WriteString( PTreeNodeData(TreeView1.Items.Data)^.GUID, 'NAME', TreeView1.Items.Text );
        INI.WriteString( PTreeNodeData(TreeView1.Items.Data)^.GUID, 'PARENT', PTreeNodeData(TreeView1.Items.Data)^.Parent );
      end;
      INI.UpdateFile;
      INI.Free;

      if Assigned(Sender) then
        ShowMessage( 'Saved!' );
    end;

    procedure TForm1.FormCreate(Sender: TObject);
    begin
      ReloadTree;
    end;

    procedure TForm1.ReloadTree;
      procedure MapItems;
      var
        i, j : integer;
        pNodeData : PTreeNodeData;
      begin
        i := 0;
        while (i < TreeView1.Items.Count) do
        begin
          j := 0;
          while (j < TreeView1.Items.Count) do
          begin
            if (PTreeNodeData(TreeView1.Items.Data)^.GUID = PTreeNodeData(TreeView1.Items[j].Data)^.Parent) and
               (PTreeNodeData(TreeView1.Items[j].Data)^.Mapped = False) then
            begin
              PTreeNodeData(TreeView1.Items[j].Data)^.Mapped := True;
              TreeView1.Items[j].MoveTo( TreeView1.Items, naAddChild );
              j := 0;
            end
            else
              inc(j);
          end;
          inc(i);
        end;
      end;

    var
      INI : TMemINIFile;
      GUIDs : TStringList;
      Parent, Item : TTreeNode;
      i : integer;
      pNodeData : PTreeNodeData;
    begin
      INI := TMemINIFile.Create( 'tree.ini' );
      GUIDs := TStringList.Create;
      INI.ReadSections( GUIDs ); //Load all the sections/GUIDs

      TreeView1.Items.BeginUpdate;
      TreeView1.Items.Clear;

      //Let's add all to the tree...assumption is all is orphans
      for i := 0 to GUIDs.Count - 1 do
      begin
        pNodeData := AllocMem( SizeOf(TTreeNodeData) );
        Initialize( pNodeData^ );
        pNodeData^.GUID := GUIDs.Strings;
        pNodeData^.Mapped := False;
        pNodeData^.Parent := INI.ReadString( GUIDs.Strings, 'PARENT', '' );
        //Create all in root
        Item := TreeView1.Items.Add( Nil, INI.ReadString( GUIDs.Strings, 'NAME', '' ) );
        Item.Data := pNodeData;
      end;

      MapItems;

      TreeView1.Items.EndUpdate;

      GUIDs.Free;
      INI.Free;
    end;

    procedure TForm1.TreeView1DragDrop(Sender, Source: TObject; X, Y: Integer);
    var
      SourceNode, TargetNode : TTreeNode;
    begin
      SourceNode := TreeView1.Selected;
      TargetNode := TreeView1.GetNodeAt( X, Y );
      if Assigned(TargetNode) and Assigned(SourceNode) then
      begin
        PTreeNodeData(SourceNode.Data)^.Parent := PTreeNodeData(TargetNode.Data)^.GUID;
        SourceNode.MoveTo( TargetNode, naAddChild );

        //Save INI without messagebox
        Button2Click( Nil );
      end;
    end;

    procedure TForm1.TreeView1DragOver(Sender, Source: TObject; X, Y: Integer;
      State: TDragState; var Accept: Boolean);
    var
      Src, Dst: TTreeNode;
    begin
      Src := TreeView1.Selected;
      Dst := TreeView1.GetNodeAt(X,Y);
      Accept := Assigned(Dst) and (Src<>Dst);
    end;

    procedure TForm1.FormDestroy(Sender: TObject);
    var
      i : integer;
    begin
      for i := 0 to TreeView1.Items.Count - 1 do
      begin
        Finalize( PTreeNodeData(TreeView1.Items.Data)^ );
        FreeMem( TreeView1.Items.Data );
      end;
    end;

    end.

     

     

    • Upvote 1
  4. Hi Farshad

     

    I have been looking at the Sencha forums regarding the camera feature. Have have seen some code on how to use the camera. Can you maybe give an idea on how one would go about to integrate the following code: https://github.com/CaliLuke/NativeContacts/blob/master/app/view/Picture.js

     

    It looks like (See code in bold below):

    /*
     * File: app/view/Picture.js
     *
     * This file was generated by Sencha Architect version 2.0.0.
     * http://www.sencha.com/products/architect/
     *
     * This file requires use of the Sencha Touch 2.0.x library, under independent license.
     * License of Sencha Architect does not include license for Sencha Touch 2.0.x. For more
     * details see http://www.sencha.com/licenseor contact license@sencha.com.
     *
     * This file will be auto-generated each and everytime you save your project.
     *
     * Do NOT hand edit this file.
     */

    Ext.define('Contact.view.Picture', {
        extend: 'Ext.Container',
        alias: 'widget.contactpic',

        config: {
            height: 120,
            minHeight: 100,
            style: 'overflow: hidden',
            ui: '',
            layout: {
                align: 'center',
                type: 'vbox'
            },
            overflow: 'hidden',
            tpl: [
                '<img src="{picture}" width="160" />'
            ],
            items: [
                {
                    xtype: 'component',
                    html: ''
                },
                {
                    xtype: 'button',
                    bottom: 5,
                    itemId: 'mybutton',
                    right: 5,
                    iconCls: 'add',
                    iconMask: true
                }
            ],
            listeners: [
                {
                    fn: 'onMybuttonTap',
                    event: 'tap',
                    delegate: '#mybutton'
                }
            ]
        },

        onMybuttonTap: function(button, e, options) {
            Ext.device.Camera.capture({
                source: 'camera',
                destination: 'file',

                success: function(url) {
                    this.fireEvent('change', this, url);
                },
                failure: function() {
                    Ext.Msg.alert('Error', 'There was an error when acquiring the picture.');
                },
                scope: this
            });
        }


    });

×
×
  • Create New...