dk / Prima

prima.eu.org
Other
106 stars 27 forks source link

grey noise when using pack gm in $frameset->insert_to_frame #48

Closed MaxPerl closed 7 years ago

MaxPerl commented 7 years ago

Dear Dimitry, Sorry for posting so much bug reports, but I noticed again a little problem in Linux and Windows.

The following frameset code causes grey noise in Windows and Linux. After Resizing the main window the labels and framesets are shown correctely:


use Prima;
use Prima::Application;
use Prima::Label;
use Prima::IntUtils;
use Prima::FrameSet;

# Füge dem Program ein Icon hinzu
#my $icon = Prima::Icon->load('camel.png');
#$::application->icon($icon);

# Erstelle das HauptFenster
my $mw = Prima::MainWindow->new(
        size => [300, 200],
        text => 'Grid example');

my $fs = Prima::FrameSet->create(
    owner => $mw,
    size => [300, 200],
    arrangement => fra::Vertical,
    frameSizes => [("50%", "50%")],
    pack => {expand => 1, fill => both}
);

my $label = $fs->insert_to_frame(
    1,
    Label,
    text => 'This is top',
    pack => {expand => 1, fill => both}

);

my $label2 = $fs->insert_to_frame(
    0,
    Label,
    text => 'This is bottom',
    pack => {expand => 1, fill => both}
);

run Prima;

Furthermore when frameSize in the Prima::Frameset->create method is not set, I get the following error:

Can't use an undefined value as an ARRAY reference at /usr/local/lib/x86_64-linux-gnu/perl/5.22.2/Prima/FrameSet.pm line 409.

But perhaps this is normal?

dk commented 7 years ago

Hi Max,

I've fixed the frameSizes bug, thank you. Sorry this file one of few I did not author.

As for the other problem, I suggest not using pack but growMode instead:

use strict;
use warnings;
use Prima qw(Application FrameSet Label);

# F├╝ge dem Program ein Icon hinzu
#my $icon = Prima::Icon->load('camel.png');
#$::application->icon($icon);

# Erstelle das HauptFenster
my $mw = Prima::MainWindow->new(
                size => [300, 200],
                text => 'Grid example');

my $fs = Prima::FrameSet->create(
        owner => $mw,
        size => [300, 200],
        arrangement => fra::Vertical,
        pack => {expand => 1, fill => 'both'}
);                                                                                                                                                             

my $label = $fs->insert_to_frame(                                                                                                                              
        1,
        'Label',
        text => 'This is top',
        origin => [0,0],
        growMode => gm::Client,
);
$label->size( $label->owner->size);

my $label2 = $fs->insert_to_frame(
        0,
        'Label',
        text => 'This is bottom',
        origin => [0,0],
        growMode => gm::Client,
);      
$label2->size( $label2->owner->size);

run Prima;
MaxPerl commented 7 years ago

Dear Dmitry, Thank you for your help. Damage that pack doesn't work in Prima::FrameSet. The pack geometry manager is for me much more familiar and easier to handle. But I see, I need to learn the growMode geometry manager...

dk commented 7 years ago

Hi Max,

I'm pretty sure the problem you're experience with pack is either a bug or the code is missing some extra call that is not evident/documented, and I intend to have a look at it. Meanwhile, to not block your progress, I suggest to use growMode until I figure out what's wrong with pack.

Dmitry

dk commented 7 years ago

All right, that was easy. FrameSet was conceived before pack was introduced to Prima, that's why. I think this is fixed now.

MaxPerl commented 7 years ago

Dear Dimitry, You are fantastic. Everything is fine now. Thank you so much! Nevertheless I have to learn the growMode geometry manager ;-)

dk commented 7 years ago

you're welcome ;)