Comments (20)
it is valid comment. i suggest to add "if not csLoading in ComponentState" or smth. can you try to add it?
from atflatcontrols.
I assume that you mean to add it to your component code? Will try. Been ages I've been working creating components and never done it for Lazarus, but I'll try.
from atflatcontrols.
Yes, to my code
from atflatcontrols.
I am working on it, but ended up in a stack error. Reverted back to the original, but problem persists on attabs.pas:1137
Will look into this further some other moment, I fear that I have to reinstall Laz.
from atflatcontrols.
I guess itβs ok to add this /If/ above the call of FOnTabChange
from atflatcontrols.
I fixed it. Code below
procedure TATTabs.SetTabIndex(AIndex: integer);
//note: check "if AIndex=FTabIndex" must not be here, must be in outer funcs.
//Sometimes SetTabIndex(TabIndex) is needed, eg in DeleteTab().
var
CanChange: boolean;
doClickEvent : boolean;
begin
doClickEvent := (aIndex <> FTabIndex); // Only generate onClickEvent when the tab changes
// This prevents a potential endless loop if the event
// is triggered in software (aducom)
if csLoading in ComponentState then
FTabIndexLoaded:= AIndex;
if IsIndexOk(AIndex) then
begin
CanChange:= true;
if Assigned(FOnTabChangeQuery) then
begin
FOnTabChangeQuery(Self, AIndex, CanChange);
if not CanChange then Exit;
end;
FTabIndex:= AIndex;
MakeVisible(AIndex);
Invalidate;
if Assigned(FOnTabClick) then
if not(csLoading in ComponentState) then // avoid click event while component is being created (aducom)
if doClickEvent then
FOnTabClick(Self);
end;
end;
from atflatcontrols.
Use these fence chars, pls. edited the post.
```
from atflatcontrols.
Pls see my comment in code
//note: check "if AIndex=FTabIndex" must not be here, must be in outer funcs.
//Sometimes SetTabIndex(TabIndex) is needed, eg in DeleteTab().
from atflatcontrols.
I know, but this only influences the onclick. You will get infinite loops as I had one if you don't, If you think that it should trigger on deleting tab I can modify it further.
It is not logical to trigger if a tab is being deleted. Orignal flow is not influenced.
Let me explain it a bit better. If you change a tab then the event is triggered. If this trigger is caused by some program code it will trigger also. It makes no sence to trigger if the tab is not being changed. Of course you can do that from the outside, but if you don't (and it's not so obvious to do) then you end up with a stack error and that will be hard to find. I think you should do it in the component. If you delete a tab, then it is not logical to trigger an onclick because the deleted tab is not present any more.
from atflatcontrols.
okay. made this change, pls check it.
from atflatcontrols.
Confirmed. Thnx.
from atflatcontrols.
partially reverted, sorry- it gave problems in CudaText- initial tab was not shown+ clicking tab title didn't focus the tab.
from atflatcontrols.
I'm back to my stack error. Well, for now, I'll work with my own patch. Am not using Cudatext so can't judge implications. But it's good that the initialization issue if fixed. I don't have issues showing the initial tab. Focus issue is an interesting one though. (FTabIndex=-1 in the constructor will trigger initial change)
from atflatcontrols.
What do you think of adding an event ontabchanged? That will only fire if oldtab != newtab, made an implementation that I will test next week. Same for property tabvisible (ttabsheet compatibility)
from atflatcontrols.
Maybe show ur implementation, is it small code
from atflatcontrols.
Well, the onchange is a few lines of code and works well. The tabvisible should be similar, but I'm still strugling with the application flow, no matter what value I give the property, the status is always false. Within design mode it works well. But I'll get to it.
from atflatcontrols.
Ok, I have added the ontabchanged event and tested it. Should work ok with your other components. I also added the tabvisible property and two routines ShowTab(index) and HideTab(index). The function takes care of the tabindex to avoid issues with bound notebookpages if any. The issue is that I don't want to publish the full text here, unless you want me to. I have a small sample too showing the features. I can make a downloadable zip and publish for you. Let me know.
from atflatcontrols.
you can make a pull-request on github. in ATFlatCon repo, find file attabs.pas on site, then press EDIT button to edit it, paste your file.
check the changes in pull-req page.
from atflatcontrols.
Thanks, I have fixed your code a little.
from atflatcontrols.
Thanks, I have fixed your code a little.
Yes, seen that, but logical choice ;-)
from atflatcontrols.
Related Issues (20)
- Drag/drop from other controls not working HOT 7
- Font scaling correction HOT 8
- Question about buttons placed on the left side and tabwidth of the leftmost tab after scrolling HOT 4
- Can't compile ATCanvasPrimitives in 10.4 HOT 4
- How put a form insde tTab or controls like tpage HOT 3
- Prob with DragDrop (unexpected exchange of tabs)? HOT 14
- TATTabs: Missing Event while reordering Tabs HOT 7
- Little problem again HOT 4
- Small problem
- Little problem in Delphi
- How to change the position of dropdown list of a ATComboEdit? HOT 6
- Bug report in TabChangeQuery HOT 3
- Case where changed Data.TabHint is not reliably propagated to tab's hint HOT 9
- Problem HOT 2
- Delphi 11 + TAntialiasingMode HOT 8
- ATStatusBar.pas - Delphi 10.2 HOT 1
- Option for right click HOT 2
- OptMouseDragOutEnabled broken? HOT 3
- Drag marker shown after context menu HOT 21
- Drag marker shown at left click on active tab HOT 11
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from atflatcontrols.