Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » inconsistest setImage(null) on Label control
inconsistest setImage(null) on Label control [message #1743100] Mon, 12 September 2016 09:49 Go to next message
Nicola  Zanaga is currently offline Nicola ZanagaFriend
Messages: 48
Registered: July 2009
Member
call to setImage(null), clear the label text, below the snippet:

        final Display display = NUiSwtApplicationSession.get().getDisplay();
        Shell shell = new Shell(display);

        Label l = new Label(shell, SWT.NONE);
        l.setText("hello");
        l.setImage(null);
        l.pack();

        shell.pack();
        shell.open();



With the snippet above, you get a label with no text and no image.

With the sequence:
        l.setImage(null);
        l.setText("hello");


the text is shown correctly


Re: inconsistest setImage(null) on Label control [message #1743388 is a reply to message #1743100] Wed, 14 September 2016 19:20 Go to previous messageGo to next message
Brian de Alwis is currently offline Brian de AlwisFriend
Messages: 694
Registered: January 2012
Senior Member

A label displays a string OR an image. Not both. Use a CLabel to have both an image AND a string.

Eclipse Platform committer. Ask me about Eclipse support, training, and consulting.
Re: inconsistest setImage(null) on Label control [message #1743581 is a reply to message #1743388] Fri, 16 September 2016 14:41 Go to previous message
Nicola  Zanaga is currently offline Nicola ZanagaFriend
Messages: 48
Registered: July 2009
Member
I don't want display image and text.

I want to display text or image, but I mean that calling setImage(null) null = no image
after the text, does the wrong result.

In fact, the result is that the label has no image and no text.
Previous Topic:How to get the innerHTML of object on mouseover with SWT browser
Next Topic:Embedded SWT Browser behaving differently then outside or in debug mode..
Goto Forum:
  


Current Time: Mon Dec 18 07:22:18 GMT 2017

Powered by FUDForum. Page generated in 0.01599 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software