Board index » cppbuilder » event when a frame gets focused
Simon Rydberg
![]() CBuilder Developer |
Simon Rydberg
![]() CBuilder Developer |
event when a frame gets focused2005-10-24 06:51:00 PM cppbuilder1 I wonder which event I can override when a frame get's focused.. I want to update a grid, but only when the user selects the frame and makes it active. /Simon |
Hans Galema
![]() CBuilder Developer |
2005-10-24 07:28:35 PM
Re:event when a frame gets focused
Simon Rydberg wrote:
QuoteI wonder which event I can override when a frame get's focused.. I want to scenario. Hans. |
Simon Rydberg
![]() CBuilder Developer |
2005-10-25 02:17:29 PM
Re:event when a frame gets focused
I have a frame that I'm going to "glue" on a form/tabsheet/panel and I want
to update the grid on the form when the user see the frame, or make the frame active. But I can't find that event. And I only want to to the update the first time the user makes the frame active. not every time he clicks on it. But I want to update the frame if it's in a tabsheet and the user switches between the sheets. So every time the frame becomes the active one I want to update the grid. Hope that you understand what I mean. /simon "Hans Galema" < XXXX@XXXXX.COM >skrev i meddelandet QuoteSimon Rydberg wrote: {smallsort} |
Hans Galema
![]() CBuilder Developer |
2005-10-25 04:02:57 PM
Re:event when a frame gets focused
Simon Rydberg wrote:
QuoteI have a frame Quotethat I'm going to "glue" on a form/tabsheet/panel and I want QuoteBut I can't find that event. QuoteAnd I only want to to the update a private bool which will tell you. private: // User declarations bool updatedone; As soon as you did the update set the bool to true. Check the bool before updating. QuoteBut I want to update the frame if it's in a tabsheet and the user OnChange event. QuoteHope that you understand what I mean. |
Simon Rydberg
![]() CBuilder Developer |
2005-10-25 08:53:03 PM
Re:event when a frame gets focused
It's a TFrame and on the TFrame there is a TAdvStringGrid from tmsSoftware,
works in a similar way as a ordinary TStringGgrid. What I mean with the frame becoming active is, when the user selects the form/tabsheet that the TFrame is glued on. For example, consider the following code: ... TFrameView *view1 = new TFrameView(this); view1 ->Name = "view1"; TFormPasteForm *form1= new TFormPasteForm(this, view1); form1->Show(); TFrameView *view2 = new TFrameView(this); view1 ->Name = "view2"; TFormPasteForm *form2= new TFormPasteForm(this, view2); form2->Show(); ... and in __fastcall TFormPasteForm::TFormPasteForm(TComponent* Owner, TFrame *frame) : TForm(Owner) { if (frame != NULL) { frame->Parent = this; frame->Align = alClient; frame->Show(); } } This is basicly what I mean, and on the TFrameView I have some components, including a TAdvStringGrid that I want to update when the user selects the form that the TFrameView is on. So the user selects form1 and I want to run some code, when the user later select form2 I want to run some code, and if the user selects form1 I want to run some code, and if he selects form2 again I want to run some code. This is what I mean by "The frame is active" it's the TFrameView that the user is currently looking at or starting edit. The frame that the user is currently interacting with. I'm looking after a way that the frame itself knows when to update itself when it becomes active. Trying to avoid dependencies. For example using a TabSheets OnShow event makes the tabsheet aware of TFrameView. It would have been fine if I had the option to make TFrameView implement an interface, for example: class FrameUpdater{ public: virtual void update()=0; }; and later on... class TFrameView : public TFrame, public FrameUpdater { ... void update() { updating my grids and compo}; ... } and then in the onshow event: ... ((FrameUpdater*)myGluedFrame)->update(); but multipel inheritance on vcl classes is not allowed in Borland Builder 5, it is however possible in Borland Builder 6 but the project that I'm working on can't compile in version 6 due to third-party dependencies. Do not know if it is possible to do what I want. /simon "Hans Galema" < XXXX@XXXXX.COM >skrev i meddelandet QuoteSimon Rydberg wrote: |
Hans Galema
![]() CBuilder Developer |
2005-10-25 09:24:05 PM
Re:event when a frame gets focused
Simon Rydberg wrote:
QuoteI'm looking after a way that the frame itself knows when to update itself Quoteclass TFrameView : public TFrame, public FrameUpdater { ... public: void update() { updating my grids and compo}; ... } and then in the onshow event: ... myGluedFrame->update(); Please start t{*word*220} your quotes. (Do not repost complete messages). Hans. |