logo
down
shadow

TabItem does not refresh when list of tabItem has changed in SWT


TabItem does not refresh when list of tabItem has changed in SWT

By : Piotr Skalski
Date : November 18 2020, 03:49 PM
This might help you Your problem is in the SWT's TabItem class, in the setControl() function. At the end of this function it makes an: oldControl.setVisible (false);
So in your situation the oldControl will be the same control you set (it you set it twice) and it will be hidden. To solve the problem you can modify the code as:
code :
btn.addListener (SWT.Selection,  new Listener() {           
    public void handleEvent(Event e) {
            if (!newString.isEmpty()) {
                item1.setControl(list1);
                list1.setVisible(true);
            } else {
                item1.setControl(list);
                list.setVisible(true);
            }
    }
});
btn.addListener (SWT.Selection,  new Listener() {           
    public void handleEvent(Event e) {
            if (newString != null && !newString.isEmpty()) {
                if (item1.getControl() != list1) {
                    item1.setControl(list1);
                }
            } else {
                if (item1.getControl() != list) {
                    item1.setControl(list);
                }
            }
    }
});


Share : facebook icon twitter icon
Silverlight TabControl - Finding and selecting a TabItem from a given Control in the TabItem

Silverlight TabControl - Finding and selecting a TabItem from a given Control in the TabItem


By : user1960283
Date : March 29 2020, 07:55 AM
fixed the issue. Will look into that further How I solved it (by asking the Lead Architect)...
Create an Interface ITabActivator with one method Activate.
TabItem - how to access element in custom HeaderTemplate from TabItem Style Trigger

TabItem - how to access element in custom HeaderTemplate from TabItem Style Trigger


By : manish sharma
Date : March 29 2020, 07:55 AM
will help you I would set the style trigger on your Button instead of on the TabItem, and use a RelativeSource binding to get the TabItem.IsSelected value
code :
<Style x:Key="CloseButtonStyle" TargetType="{x:Type Button}">
    <Setter Property="Visibility" Value="Visible"></Setter>
    <Style.Triggers>
        <DataTrigger Property="{Binding IsSelected, RelativeSource={RelativeSource AncestorType={x:Type TabItem}}" Value="True">
            <Setter Property="Visibility" Value="Visible"></Setter>
        </DataTrigger >
    </Style.Triggers>
</Style>
WPF TabItem OnMouseOver shall trigger the visibility of a Button inside the TabItem

WPF TabItem OnMouseOver shall trigger the visibility of a Button inside the TabItem


By : paras saini
Date : March 29 2020, 07:55 AM
it fixes the issue It looks as though your TabItem does not have the background set so it is not catching the MouseOverEvent. Since the TextBlock has the foreground set and has text, it captures the MouseOverEvent. Try setting the Background child grid of the DataTemplate to Transparent and you should see that the MouseOverEvent will be caught and show the close button.
code :
<TabControl x:Name="tabControl" ItemsSource="{Binding OpenedItems}">
    <TabControl.ItemTemplate>
        <DataTemplate>
             <Grid Name="grid" VerticalAlignment="Center" Background="Transparent">
                ...
             </Grid>
             ...
        </DataTemplate>
    </TabControl.ItemTemplate>
    ...
 </TabControl>
Custom TabItem properties (TabItem.Content and TabItem.Header)

Custom TabItem properties (TabItem.Content and TabItem.Header)


By : AndreaMarinetti
Date : March 29 2020, 07:55 AM
help you fix your problem This runs completely counter to how WPF was designed to be used. Your XAML objects are supposed to be loosely bound to data, in the vast majority of cases you shouldn't even need to create a custom control. The fact that you are doing this, and then trying to replace the members with type-safe versions of your own, means your view code and your view logic code are no longer separated, and that is going to create you a world of headache down the track.
If you need dynamic tabbing then one way to do it is to first declare an abstract class representing your pages and to derive your page types from it:
code :
public interface IBasePage
{
    string Header { get; }
}

public class MyPageA : ViewModelBase, IBasePage
{
    public string Header { get { return "Page A"; } }
}

public class MyPageB : ViewModelBase, IBasePage
{
    public string Header { get {return "Page B";} }
}

public class MyPageC : ViewModelBase, IBasePage
{
    public string Header { get {return "Page C";} }
}
public class MyViewModel : ViewModelBase
{
    private IEnumerable<IBasePage> _MyPages = new List<IBasePage>(){
        new MyPageA(),
        new MyPageB(),
        new MyPageC()
    };
    public IEnumerable<IBasePage> MyPages {get {return this._MyPages;}}
}
<TabControl ItemsSource="{Binding MyPages}" SelectedItem="{Binding MyPages[0], Mode=OneTime}">
    <TabControl.Resources>

        <!-- TabItem style -->
        <Style TargetType="{x:Type TabItem}">
            <Setter Property="Header" Value="{Binding Header}" />
        </Style>

        <!-- Content templates -->
        <DataTemplate DataType="{x:Type local:MyPageA}">
            <TextBlock Text="This is page A" />
        </DataTemplate>
        <DataTemplate DataType="{x:Type local:MyPageB}">
            <TextBlock Text="This is page B" />
        </DataTemplate>
        <DataTemplate DataType="{x:Type local:MyPageC}">
            <TextBlock Text="This is page C" />
        </DataTemplate>

    </TabControl.Resources>
</TabControl>
TabControl.Items.Remove(TabItem) does not free memory used by TabItem

TabControl.Items.Remove(TabItem) does not free memory used by TabItem


By : Manusrini22
Date : March 29 2020, 07:55 AM
With these it helps As far as I know all eventhandlers must be 'detached', also you should release all bindings on your tabItem.
Also If I am not mistaken CommandBindings, KeyGestures can also cause the leak.
Related Posts Related Posts :
  • The type org.openqa.selenium.firefox.FirefoxDriver is not accessible
  • Limitations (drawbacks) of java programming language?
  • Error: ')' expected Error: illegal start of expression
  • TableRowSorter use LookAndFeel of TableHeader, but own Comparator
  • Difference between @GeneratedValue and @GenericGenerator
  • Design Scenario: Smartphone class and will have derived classes like IPhone,AndroidPhone,WindowsMobilePhone can be even
  • Java date parsing without separators?
  • how to map an array of custom type from postgres to java using hibernate
  • Why hibernate always call "update" statement after using "select" statement in MySQL?
  • An interview topic: What can go wrong with this code?
  • How do I regex remove whitespace and newlines from a text, except for when they are in a json's string?
  • How to turn off Preferences > Compiles > User External Build?
  • how to convert arraylist to string array with all items in double quote
  • PMD+Maven+JAVA Error:: Can't find resource rulesets/comments.xml. Make sure the resource is a valid file or URL or is on
  • How to extend AbstractScheduledService.Scheduler
  • Primefaces tabview: set Active Index after some counting
  • Need help in Regex to exclude splitting string within "
  • Get header from HttpUrlConnection object
  • encoding xlsx as base64 and send it as an attachment
  • How to acess HttpServletRequest in Jaas login module in Tomcat
  • How to implement a basic pointer
  • Java Swing Exit Icon?
  • Why onNext has no effect
  • IntelliJ Idea 2018.2 no option for importing gradle project
  • Remove a negative element from an array w/o array.copy
  • Could this prevent overflow in Java?
  • In Java Swing, can I receive Caret events in real time?
  • I need help not using brute force when using JFrames and DrawWindows
  • How do I refactor ArrayList<MyClass> into MyClassLIst?
  • My program keeps saying that the method cannot be resolved
  • BubbleSort -my code returns random addresses
  • JavaFX components inside HTML?
  • Character in Java game not responding
  • Working around access denied in a FileWalking Tree in Java7
  • How to avoid if/else when using multple suppliers?
  • How to pass object from table cell editor to Table Model?
  • Paypal Sandbox payment state pending
  • sejda-console.bat passing parameters with spaces
  • Multiple Consumers Spring Kafka
  • Bitbucket pipeline: environmental variables in build.gradle file not recognized
  • Java static enum method to return a default enum value
  • What is the complexity of empty for loop?
  • Group randomly List of Lists as N subsets with K elements in each
  • How to set texture on a shape drawn by glDrawArrays()?
  • How to make a jlabel resizable according to the window
  • Java Mathematical Expression Syntax
  • assigning values to characters in java
  • Method overriding and Inheritance in java
  • given a set of lists/groups with a series of number, find matching numbers
  • Connection to HID USB device (keyboard and mouse) in android
  • Inject HttpServletRequest in CDI SessionScoped bean
  • Pool game in java - ball collision algorithm
  • Focus ScrollView to selected position programmatically - Android
  • Is it hibernate bug?
  • Glib memory allocation error
  • Android Proguard - step by step
  • Setting the pivot point of a JPanel to its center
  • java check time is greater time
  • how to save a screenshot (matlab)
  • Anti-aliasing filled shapes in libgdx
  • shadow
    Privacy Policy - Terms - Contact Us © ourworld-yourmove.org