cappuccino / cappuccino

Web Application Framework in JavaScript and Objective-J
https://cappuccino.dev/
GNU Lesser General Public License v2.1
2.2k stars 333 forks source link

A3 branch vs latest version Didier: CPPopUpButton does not appear #3052

Closed jasperdeb closed 1 year ago

jasperdeb commented 1 year ago

A CPPopUpButton does not appear does not appear when created by code.

// Create window
    sheet = [[CPWindow alloc] initWithContentRect:CGRectMake(0, 0, 1000, 750)  styleMask:CPResizableWindowMask]; 

    contentView = [sheet contentView];

    // ************************************ Add table view Categorie ************************************
    label = [[CPTextField alloc] initWithFrame:CGRectMake(50, 25, 350, 25)];
    [label setLineBreakMode:CPLineBreakByWordWrapping];

    var textField = [[CPTextField alloc] initWithFrame:CGRectMake(50,100,120,25)];
    [textField setStringValue:@"Diameter:"];
    [contentView addSubview:textField];

    popUp1 = [[CPPopUpButton alloc] initWithFrame:CGRectMake(200,100,50,30)];
    [popUp1 addItemWithTitle:"8"];
    [popUp1 addItemWithTitle:"10"];
    [popUp1 addItemWithTitle:"12"];
    [contentView addSubview:popUp1];

    if(diameterLijn == 8)
        [popUp1 selectItemAtIndex:0];
    if(diameterLijn == 10)
        [popUp1 selectItemAtIndex:1];
    if(diameterLijn == 12 )
        [popUp1 selectItemAtIndex:2];

    [popUp1 setTarget:self];
    [popUp1 setAction:@selector(refresh:)];

Latest master + A3 Branch image

Latest version Didier Korthoudt image

cappbot commented 1 year ago

Milestone: Someday. Label: #new. What's next? A reviewer should examine this issue.

daboe01 commented 1 year ago

@jasperdeb IIRC this is a feature introduced by didier to improve cocoa compatibility. you need to set the right theme state, try setBezelStyle:CPRoundedBezelStyle

jasperdeb commented 1 year ago

Yes it works. But isn't it more logical that a CPPopUpButton has some kind of default value when created manually by code?

image

daboe01 commented 1 year ago

iirc @didierkorthoudt introduced this to maximize cocoa compatibility.

daboe01 commented 1 year ago

-#new +Aristo3

cappbot commented 1 year ago

Milestone: Someday. Label: Aristo3. What's next? A reviewer should examine this issue.

jasperdeb commented 1 year ago

Ok, if this is designed behaviour, I will close the issue.