Jump to content

herculanojs

uniGUI Subscriber
  • Posts

    565
  • Joined

  • Last visited

  • Days Won

    12

Posts posted by herculanojs

  1. I'm uam difficulty.

    When I create dynamic DBGrid if closing the dataset and reopen again.

    The column definitions created in runtime are lost and are shown all dataset columns without any previous attributes.

    This is a bug?

     

    Fields in Dataset (ID,Nome, etc);

     

            with DBGrid.Columns.Add do
            begin
                 FieldName := 'id';
                 Title.Caption := 'ID';
                 Width := 80;
            end;
     
            with DBGrid.Columns.Add do
            begin
                 FieldName := 'nome';
                 Title.Caption := 'Nome';
                 Width := 80;
            end;
     
    After closing and opening all columns are shown

     

  2. Adjusting the Draggable property of components, you can move them on the screen. Would any other property or sample code that allow modify the component size?
     
    What I want to do, you can move and size the components.
     
     
    procedure TMainForm.NodeMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
    const
      minWidth = 20;
      minHeight = 20;
    var
      newPos: TPoint;
      frmPoint : TPoint;
      OldRect: TRect;
      AdjL,AdjR,AdjT,AdjB: Boolean;
    begin
      if FNodePositioning then
      begin
        begin
          with TUniControl(Sender) do
          begin
          GetCursorPos(newPos);
          with FCurrentNodeControl do
          begin //resize
            //....................******************************************** Here is where is the problem and can not solve********************************
            frmPoint := FCurrentNodeControl.Parent.ScreenToClient(Mouse.CursorPos);
     
            OldRect := FCurrentNodeControl.BoundsRect;
            AdjL := False;
            AdjR := False;
            AdjT := False;
            AdjB := False;
            case FNodes.IndexOf(TUniControl(Sender)) of
              0: begin
                   AdjL := True;
                   AdjT := True;
                 end;
              1: begin
                   AdjT := True;
                 end;
              2: begin
                   AdjR := True;
                   AdjT := True;
                 end;
              3: begin
                   AdjR := True;
                 end;
              4: begin
                   AdjR := True;
                   AdjB := True;
                 end;
              5: begin
                   AdjB := True;
                 end;
              6: begin
                   AdjL := True;
                   AdjB := True;
                 end;
              7: begin
                   AdjL := True;
                 end;
            end;
     
            if AdjL then
              OldRect.Left := frmPoint.X;
            if AdjR then
              OldRect.Right := frmPoint.X;
            if AdjT then
              OldRect.Top := frmPoint.Y;
            if AdjB then
              OldRect.Bottom := frmPoint.Y;
     
            SetBounds(OldRect.Left,OldRect.Top,OldRect.Right - OldRect.Left,OldRect.Bottom - OldRect.Top);
          end;
          Left := Left - oldPos.X + newPos.X;
          Top := Top - oldPos.Y + newPos.Y;
          oldPos := newPos;
          end;
        end;
        PositionNodes(FCurrentNodeControl);
      end;
     
    end;

     

    project1.zip

    src110105.zip

  3. I'm having trouble defining events in runtime. I saw in another post that the definition of the event must be made before the creation of the form, but the components are created dynamically, so you can not use the definition of code in the form creation.
     
    The code below works perfectly put in the form of creation, with the component already created. However when I create the component and attribute the event, it does not work.
     
    The event is for the UniEdit only accept numbers.
    Is there any other way to do it?
    All my form components are dynamically created.
     
    Exemple 1: component existing === OK!!
     
    procedure TMainForm.UniFormCreate(Sender: TObject);
    begin
         UniEdit1.ClientEvents.ExtEvents.Values['keypress']:='function keypress(sender, e, eOpts) {var allowed = "0123456789"; var c = e.getCharCode(); if (allowed.indexOf(String.fromCharCode©)=== -1) {e.stopEvent(); } }';
    end;

     

     

    Exemple 2: component not existing === NO!!

     

    procedure TMainForm.UniButton1Click(Sender: TObject);
    var Edit:TuniEdit;
    begin
         edit := Tuniedit.Create(self);
         edit.Left := 8;
         edit.Top := 8;
         edit.Parent := self;
         edit.Visible := True;
         edit.ClientEvents.ExtEvents.Values['keypress']:='function keypress(sender, e, eOpts) {var allowed = "0123456789"; var c = e.getCharCode(); if (allowed.indexOf(String.fromCharCode©)=== -1) {e.stopEvent(); } }';
    end;
     
    how to proceed ?

     

    Project1.rar

  4. I'm having trouble in assigning TriggerEvent when we created the component at runtime. The award of the event simply does not work. But if the event is already assigned to a component already created, it works. What should you do following example?

     

     

    Tengo problemas en la asignación de eventos TriggerEvent  cuando creamos el componente en tiempo de ejecución. El premio del evento no funciona. Pero si el evento ya está asignado a un componente ya creado, funciona. ¿Qué debo hacer? 

     

    procedure TMainForm.UniComboBox1TriggerEvent(Sender: TUniCustomComboBox;AButtonId: Integer);

    begin

            ShowMessage (IntToStr (AButtonId));

    end;

     

    with TUniComboBox(InsertControl(TUniComboBox.Create(self))) do

    begin

           Left: = 100;

           Width: = 300;

           Top: = 200;

           OnTriggerEvent: = UniComboBox1TriggerEvent;

    end;

  5. I can not make the component work when I create it at runtime.

    This only occurs with creation at runtime, does anyone have any ideas?

    If you also add some TriggersButtons at runtime, there is an ajax error Unexpected token,

     

    O62=new Ext.form.field.Trigger({id:"O62_id",cls:"",emptyText:"",fieldLabel:"",labelPad:5,labelAlign:"top",labelSeparator:"",labelStyle:"white-space:nowrap; font-family: Tahoma; font-weight:normal; color : rgb(0 ,0 ,0); padding-bottom:5px;",labelWidth:5,width:250,minLength:0,maxLength:0,trigger1Cls:"x-form-Search-trigger",itemId1:"myteste",onTrigger1Click:function() { var Button = this.itemId1;  ajaxRequest(MainForm.,"Triggerclick",["Buttons="+Button]);},name:"O62",enableKeyEvents:true,tabIndex:12,width:250,x:408,y:344});O62.nm="O62";_cdo_("O62_C",O62,null,MainForm);O8.add(O62);O13.tabIndex=13;O13.addToTab(130);O17.tabIndex=14;O17.addToTab(140);O1B.tabIndex=15;O1B.addToTab(150);O1F.tabIndex=16;O1F.addToTab(160);O27.tabIndex=17;O27.addToTab(170);O2B.tabIndex=18;O2B.addToTab(180);O2F.tabIndex=19;O2F.addToTab(190);O33.tabIndex=20;O33.addToTab(200);O37.tabIndex=21;O37.addToTab(210);O47.tabIndex=22;O47.addToTab(220);O4B.tabIndex=23;O4B.addToTab(230);O62.addToTab(120);

  6. Estoy empezando y tengo algunas dudas. Cómo lo están haciendo sus proyectos? Algún tipo de formas moduralização? Se están creando dinámica? Realizada en BPL? O están compilados con el proyecto en un único archivo ejecutable? Y cuando tienen que actualizar el cliente, ya que hacer?

×
×
  • Create New...