Jump to content

Recommended Posts

Posted

Hi ..

 

I'm building a standard user interface, multipage view type. That is many pages (TUniTabSheet) inside a Pages control (TUniPageControl) .. each one containting differente things, usually a Frame (TUniFrame) with a connected Grid inside (TUniDbGrid), to make some standard CRUD's

 

So .. to make it somewhat 'general' I need to create pages dinamically at run-time. Also I think this 'best practice', because the pages are created when needed and then destroyed (and recreated again) ..

 

Now ..

 

1. When creating the page (TUniTabSheet) .. it doesn't get focus. I must 'manually' make click on it (over the tab)

 

procedure TMainForm.UniToolButton1Click(Sender: TObject);

begin

if oPage=nil then

begin

oPage:=TUniTabSheet.Create(Self); // The Owner is a Form = TMainForm

with oPage do

begin

Name:='oPage';

Parent:=oPages; // Parent = oPages (TUniPageControl)

Caption:='Hi';

Closable:=True;

Visible:=True;

TabVisible:=True;

OnClose:=PageOnClose; // This is because 'Closable' .. closing, frees the page, so I must clean the reference.

PageIndex:=0;

end;

if oFrame=nil then

begin

oFrame:=TFrameCrud.Create(Self); // Owner is TMainForm

with oFrame do

begin

Parent:=oPage; // Parent = oPage

oGrid.WebOptions.LoadMask:=False; // If I don't put this, I get some strange error message

// oGrilla.WebOptions.LoadMaskMsg:='Loading .. ';

end;

end;

end;

oPages.ActivePage:=oPage; // Is this enough ??? .. oPages.SetFocus, oPage.SetFocus, oPages.ActivePageIndex ..

// I have tried all, doesnt' work

 

2. If .. oGrid.WebOptions.LoadMask:=True, it happens ..

 

'Cannot call method mask of null'

 

O214=new Object({id:"zero",hidden:true,resizable:false,renderer:function(){return " ";}}); O215=new Ext.grid.Column({id:"0",dataIndex:"0",renderer:_rndcll_,rdonly:true,header:"Nombre",width:1400,attr:"{}",editable:false,editor:O16E}); O212=new Ext.grid.ColumnModel({defaults: { menuDisabled: true },columns:[O214,O215]});O212.nm="O212";O214.nm="O214";O215.nm="O215";O15C.reconfigure(O17A,O212);O17A.load({params:{start:0, limit:25, options:2}});

 

Please help !

 

Thanks !!!

 

Rober

Posted

Please send a simple test case.

 

Farjad .. as always, thanks !!

 

The 'solution' was simply add

 

PageControl:=oPages; // Assigning the PageControl to the Page TabSheet

 

And it's done

 

PD: I still used to think that this is 'delphi usual programming' .. but it's not. It's 'very like' .. but not exactly. This is the source of many mistakes or misunderstandings.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...