Jump to content

artem_niko

uniGUI Subscriber
  • Posts

    635
  • Joined

  • Last visited

  • Days Won

    2

Posts posted by artem_niko

  1. 1 minute ago, Sherzod said:

    Пока не знаю. Но я думаю, что это возможно, я думаю, нужно сосредоточиться на темах диаграммы.

    I've reviewed every property. The available properties do not change the color in any way.

  2. Good afternoon!

    I will put my question in a separate topic, because I have almost solved it, but not completely, and I ask you to tell me why such an error occurs.

    So, the task: to transfer from the dynamically created UniFrame1 to the main HModule program of the DLL package, which needs to be unloaded after closing the dynamically created UniTabSheet (parent for UniFrame1).

    To date, this is what has been done.

    In MainForm, I'm creating dynamically UniTabSheet1:

    ...
    UniTabSheet1:=TUniTabSheet.Create(UniPageControl1);
    UniTabSheet1.PageControl:=UniPageControl1;
    UniTabSheet1.Parent:=UniPageControl1;
    UniTabSheet1.Name:='UniTabSheet1_Test';
    UniTabSheet1.Caption:='blabla';
    UniTabSheet1.Visible:=True;
    UniTabSheet1.Closable:=True;
    UniTabSheet1.OnClose:=UniTabSheet_Close;
    ...

    Also, after, I'm creating dynamically UniFrame1:

    UniFrame1:=TUniFrame1.Create(self);
    UniFrame1.Align:=alClient;
    UniFrame1.Parent:=UniTabSheet1;
    UniFrame1.Name:='TUniFrame1_Test';
    if UniFrame1 <> nil then
    begin
      //here, i'm transfer HModule of BPL from MainForm in my UniFrame1:
      if IsPublishedProp(UniFrame1,'GV_Test') then
      SetPropValue(UniFrame1,'GV_Test',MyHModuleValue);
    end;

    By the way, in MainForm I have it written like this:

    ...
    private
        procedure SetGlobalValue_Test(const Value: HModule);
    public
    	TransferedBPL,GettingBPL: HMoudle;
    published
        property GV_Test: HModule read TransferedBPL write SetGlobalValue_Test;
    ...
    
    //getting HModule from UniFrame1 in MainForm:
    procedure TMainForm.SetGlobalValue_Test(const Value: HMODULE);
    begin
      GettingBPL:=Value;
    end;
    
    //unload BPL by getting HModule:
    procedure TMainForm.UnloadAfterCloseUniTabSheet;
    begin
      SetGlobalValue_Test(GettingBPL);
      UnloadPackage(GettingBPL);
    end;
    
    //when closing UniTabSheet1:
    procedure TMainForm.UniTabSheet_Close(Sender: TObject; var AllowClose: Boolean);
    begin
      UnloadAfterCloseUniTabSheet;
    end;

    In UniFrame 1, I get my HModule like this:

    ...
    private
        procedure SetGlobalValue_Test2(const Value: HModule);
    public
    	TransferedBPL: HMoudle;
    published
        property GV_Test2: HModule read TransferedBPL write SetGlobalValue_Test2;
    ...
    
    procedure TUniFrame1.SetGlobalValue_Test2(const Value: HMODULE);
    begin
      GV_Test2:=Value;
    end;

    In UniFrame1:

    procedure TUniFrame1.UniLabel1Click(Sender: TObject);
    begin
      if TransferedBPL <> 0 then
      begin
        if IsPublishedProp((Parent as TUniTabSheet),'GV_Test2') then
           SetPropValue((Parent as TUniTabSheet),'GV_Test2',TransferedBPL);
        end;
      end;
      (Parent as TUniTabSheet).Close;
    end;

    But, where I'm appling all this code, I'm getting error:

    image.png.be2b4af143d8f4a2c15c716145185c83.png

    Please, help me...

    I found out for sure that all the code above works up to the point that my HModule is passed from MainForm to UniFrame1, I know for sure that it works.
    I can't pass this HModule back to MainForm.

  3. Hello, again!)

    Well, I'll try to explain what I've done so far.
    So, in the main application, I prescribed:

    ...
    private
        procedure SetGlobalValue_UnloadingBPL(const Value: HModule);
    public
        test1, test2: HModule; //test1 - что передаю, test2 - для обратного получения в главное приложение
        property GV_UnloadingBPL: HModule read UnloadingBPL write SetGlobalValue_UnloadingBPL;
    ...

    The code of the button for passing the variable to the frame:

    ...
        if IsPublishedProp(Frame1,'GV_UnloadingBPL') then
           SetPropValue(Frame1,'GV_UnloadingBPL',test1);
    ...

    Now I get my variable in the frame itself:

    ...
    private
        procedure SetGlobalValue_GettingBPL(const Value: HModule);
    public
        FG_GettingValue: HModule; //куда запоминаю переменную
        property GV_UnloadingBPL: HModule read FG_GettingValue write SetGlobalValue_GettingBPL;
    ...

    Code for getting a variable in a frame:

    procedure TUniFrameG1.SetGlobalValue_GettingBPL(const Value: NativeUInt);
    begin
      FG_GettingValue:=Value;
    end;

    And here is the code when the frame closes (it closes by timer):

    procedure TUniFrameG1.UniTimer_CloseTimer(Sender: TObject);
    begin
          if IsPublishedProp(Self,'test2') then
             SetPropValue(Self,'test2',FG_GettingValue);
    end;

    Then, I try to unload the BPL in the main program when closing TabSheet1:

    procedure TMainForm.UniTabSheet1_Close(Sender: TObject; var AllowClose: Boolean);
    begin
      SetGlobalValue_UnloadingBPL(test2);
    
      if test2<> 0 then
      begin
        ShowMessage('Пакет загружен');
        UnloadPackage(test2);
      end;
    end;

    And so, when doing all this, I get an error in the main program: Invalid package handle

    Please, help me...

  4. 1 minute ago, Sherzod said:

    Извините, я так не думаю, например, нет класса rounded ...

    Here is class rounded:

    .rounded
    	{
    	 border-radius: 12px;
    	 border-color: #cccccc!important; /*color of border of forms*/
    	 border-width: 0px!;
    	 color: #cccccc!important;
    	 background-color:#ffffff!important; /*color of form*/
    	}

     

  5. 2 minutes ago, Sherzod said:

    Can you make a simple testcase with customCss you are using?

    So I have already given an example of the code from my CSS file. Everything related to CSS and what applies to Uipagecontrol is the code above, it makes no sense to make a separate example to apply the same code to it.

    I really need to remove this line, it annoys me terribly, but I can't figure out what code to prescribe for it, I've already written it in any way...

  6. 7 minutes ago, Sherzod said:

    Something like this I guess:

    CustomCSS ->

    .rounded .x-tab-bar-strip {
        border-color: green;
    }

     

    No effect...

    May be, this is because I'm also using this?

    image.png.3870410d63e649072916b801d9d8737f.png

    .myNoBorderCSS .x-panel-body-default
    	{
        background: #ffffff!important; /*color of UniTabSheet*/
        border-color: #cccccc!important;
        color: #cccccc!important;
        border-width: 0px !important;
        border-style: none !important;
        border-top-color: #f5f5f5!important;
    	}

     

  7. 1 minute ago, Sherzod said:

    Hello,

    It seems you have found ->

    x-tab-bar-strip

     

    Here is fragment from my CSS file:

    ._tab-bar .x-tab-bar
    	{
    	 background-color: none !important; 
    	 border-style: transparent !important; 
    	 background-color: transparent !important;
    	 border-color: #ccc !important; 
    	 border-bottom-color: #cccccc !important;
    	 border: none !important;
    	}
    
    ._tab .x-tab
    	{
    	 background-color:#f3f3f3!important; 
    	 border-color: #cccccc!important; 
    	 border-bottom-color: transparent!important; 
    	 border-top-left-radius: 10px!important;
    	 border-top-right-radius: 10px!important;
    	 border-bottom-left-radius: 10px!important;
    	 border-bottom-right-radius: 10px!important;
    	}
    ._tab-active .x-tab-active
    	{
    	font-family:Arial,Helvetica,sans-serif!important;
    	font-weight:bold;
    	font-size:14px;
    	background-color: #feffe3!important; 
    	border-color: #ccc!important; 
    	border-bottom-color: #ccc!important; 
    	}

    Where should I place the code

    x-tab-bar-strip

    to change the color of this line?

    I apply the class above like this:

    image.png.9c0a3acfe8bd101255a04f0decbfa998.png

  8. Good afternoon!

    Using F12, I'm trying to find the name of this line in UniPageControl. I need to manage her style through CSS, but as soon as I haven't tried - to no avail.
    Here's what F12 shows:

    image.thumb.png.0db7ff0b62dd79b398d33298d8d93133.png

    How do I write this line in the CSS file correctly, what line should I add that would change its style? For example, change its color.

  9. 48 minutes ago, Sherzod said:

    No problem, add to MainForm.Script

    Yes, it seems I added a script to MainForm, the button seems to be created, but it does not "fill" the menu of open tabs (see the Sheets button):

    image.thumb.png.ad12292fcb69c499a00b45f1d18e40f5.png

    And as for the button on the green panel, I said about it that it would be made on the same level with the tabs, of which I have only 5 pieces fixed. In this button, the menu is filled in as it should, with pictures and working tab navigation...

  10. 4 minutes ago, Sherzod said:

    Yes, I understand you. This can be done from the above solution you say. You can try.
    I will also try to analyze.

    I'm deleting from code:

    function tabPanel.afterrender(sender, eOpts)
    {
        var tabItems=[];
        this.tabBar.getRefItems().forEach(function(item,i){
            tabItems.push({
                icon: item.icon,
                index: i, 
                text: item.title, 
                handler: function(item){
                    sender.setActiveItem(item.index)
                }
            })
        });
        
          var header=this.getHeader();
        if (header) {
            header.setStyle('background', 'red');
            header.setStyle('background-color', 'transparent');
            header.setStyle('border', 'transparent');
        }
    }

    This:

        this.addTool({
            text: 'Разделы модуля', 
            xtype: 'splitbutton',      
            menu: new Ext.menu.Menu({items: tabItems})
        });

    And the title with the old button disappeared.
    It remains only to understand how to correct and prescribe the filling of the menu and that's it...

  11. 18 minutes ago, Sherzod said:

    Try this, just did it again.

    1. UniHiddenPanel1 -> UniMenuButton1

    2. Form OnReady ->

    procedure TMainForm.UniFormReady(Sender: TObject);
    begin
     with UniPageControl1.JSInterface do
     begin
     JSCall('tabPanel.tabBar.add', [JSObject('xtype: "tbfill"')]);
        JSCall('tabPanel.tabBar.add', [UniMenuButton1.JSControl]);
     end;
    end;

     

    Yes, thanks, it works.
    But, how can I prescribe that the menu with the names of tabs is also filled in UniMenuButton1, with the ability to navigate through them, as is done in the case of creating a button with a list with a separate title?

  12. On 5/15/2022 at 12:21 AM, Sherzod said:

    Made the following:

    1. UniMenuButton1
    2. UniPageControl1.ClientEvents.ExtEvents -> function tabPanel.afterrender(sender, eOpts)

    function tabPanel.afterrender(sender, eOpts)
    {
        var tabItems=[];
        this.tabBar.getRefItems().forEach(function(item,i){
            tabItems.push({
                index: i, 
                text: 
                item.title, 
                handler: function(item){
                    sender.setActiveItem(item.index)
                }
            })
        });
        this.addTool({
            text: 'Sheets', 
            xtype: 'splitbutton',  
            menu: new Ext.menu.Menu({items: tabItems})
        });
    }

    image.png.2d9fa4b443b4c762ea38f1266010591e.png

    @Sherzod, this is you code with header...

    How make without header?

  13. 5 minutes ago, Sherzod said:

    Well, it's not a good idea if you have many tabs.

    Well, I will know in advance the number of tabs, it will not be large so that it would be inconvenient)
    But, where there will be a lot of them, I will use the code that is now and create a menu above the tabs, and where there are 3-4 tabs, then you can save space and arrange the menu on the same level with the tabs.

    How to make the second option?

  14. On 8/22/2021 at 10:48 PM, herculanojs said:

    image.png.53cedcc7ba11bd5f3b76834ed2cc9c61.png

    image.thumb.png.c890c984ace8faa89024ee49114db62a.png

    image.png.01af1cdf8b51f39a1bde01a73867e6c8.png

    image.png.c013398cc152aafedf2a1d4f3c91d405.png

    Hello!

    Is it possible transfer HModule from MainForm, using code?

    As, by analogy for string values:

    var
      MyHModuleVar: HMODULE;
    begin
    ...
    if IsPublishedProp(UniFrame1,'GV_Test') then
       SetPropValue(UniFrame1,'GV_Test',MyHModuleVar);
    ...

    In UniFrame1:

     ...
    private
        procedure SetGlobalValue(const MyHModuleVar: HMODULE);
    ...

    and:

    ... 
    published
        property GV_Test: hmodule read GetttingValue write SetGlobalValue;

    It seems to work, my HModule variable is passed, but when I use the UnloadPackage(MyHModuleVar) function in UniFrame1, I get an AV error...

  15. 15 minutes ago, bahry said:

    если родительским элементом pagecontrol является основная форма

    вы можете вызвать mainform.PageControl1.ActivePage.Закрыть;

    Well, in general, yes, that's right. 
    On the MainForm of the main application, I have UniPageControl1, on which UniTabSheet1 is created dynamically and immediately UniFrame1 is loaded dynamically to this tab. Therefore, I need, by clicking on the button on the loaded UniFrame1, to close its parent (UniTabSheet1), which has its parent (UniPageControl1).

    Will it work?

    mainform.PageControl1.ActivePage.Close;

    After all, my UniFrame1 knows nothing about UniPageControl1, which is located on MainForm...

    Here, I drew a diagram to make it clearer who is the parent of whom:

    image.png.479ce7d14951c39d7005f851b40c969b.png

    My code is in the button above - it works, everything closes as it should, but when I reconnect UniFrame1, the updated UniFrame1 does not load, because of this error, most likely:

    image.png.45fe0ced6814034448806c00fe473209.png

    Or because xxx.dll is not unloaded somehow.
    Everything works only after restarting the server, which is not correct.

×
×
  • Create New...