Recent

Author Topic: Cocoa - How to get started with helping?  (Read 37043 times)

Hansaplast

  • Hero Member
  • *****
  • Posts: 674
  • Tweaking4All.com
    • Tweaking4All
Re: Cocoa - How to get started with helping?
« Reply #60 on: December 29, 2017, 10:50:34 pm »
Is this what you had in mind?
(maybe minus the Carbon version)

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: Cocoa - How to get started with helping?
« Reply #61 on: December 29, 2017, 10:59:27 pm »
Cocoa-WS font seems to be smaller than Xcode :/
Not good.

Hansaplast

  • Hero Member
  • *****
  • Posts: 674
  • Tweaking4All.com
    • Tweaking4All
Re: Cocoa - How to get started with helping?
« Reply #62 on: December 29, 2017, 11:32:49 pm »
Not sure how helpful this is, but a few things seem "off" (I matched width and height and tripple checked).
I couldn't find any button with flexible height in XCode except for the gradient one.
I think the fonts are actually the same size, or am I not seeing this right?

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: Cocoa - How to get started with helping?
« Reply #63 on: December 30, 2017, 01:12:59 am »
I think the fonts are actually the same size, or am I not seeing this right?
let's magnify a bit

Xcode on top
LCL at the bottom
« Last Edit: December 30, 2017, 05:51:11 am by skalogryz »

Hansaplast

  • Hero Member
  • *****
  • Posts: 674
  • Tweaking4All.com
    • Tweaking4All
Re: Cocoa - How to get started with helping?
« Reply #64 on: December 30, 2017, 01:34:26 am »
Allright, I think your name is eagle-eye  ;) ! Anyhoo; you're right!
Let me know what else you'd like me to test.

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: Cocoa - How to get started with helping?
« Reply #65 on: December 30, 2017, 03:54:36 am »
Can you figure out why LCL font size is smaller that Xcode’s?
By default is should be identical.

Hansaplast

  • Hero Member
  • *****
  • Posts: 674
  • Tweaking4All.com
    • Tweaking4All
Re: Cocoa - How to get started with helping?
« Reply #66 on: December 30, 2017, 04:40:18 pm »
I'd love to help figuring this out, but my experience with Cocoa/XCode/Objective-C is pretty much zero. I did do a few attempts to work with Objective-C/Swift and XCode, but XCode is just not the tool for me (that's why I use Lazarus haha).


If you can give me some pointers to get started, I'd be more than happy to toy with it.


Do I understand this right; we want CocoaWS to behave like XCode, and we do not want to try to have Cocoa match Windows/Linux? With the latter I mean; if I design a Form, I'd like it to look comparable between all LCL versions so I can recompile apps with minimal effort on other platforms.

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: Cocoa - How to get started with helping?
« Reply #67 on: December 30, 2017, 05:16:46 pm »
If you can give me some pointers to get started, I'd be more than happy to toy with it.
If you look at  TCocoaWSButton.CreateHandle (at CocoaWSStdCtrls)
you should find a suspicious line
Code: [Select]
btn.adjustFontToControlSize:=true;
How does LCL button look like, if you change the value  to false?

Do I understand this right; we want CocoaWS to behave like XCode, and we do not want to try to have Cocoa match Windows/Linux? With the latter I mean; if I design a Form, I'd like it to look comparable between all LCL versions so I can recompile apps with minimal effort on other platforms.
Yes, your understanding is correct.
We're trying to match CocoaWS to native controls look and feel as much as possible.

Yet, the code itself should remain compatible with Windows and Linux.
Design should be as close as possible to Windows and Linux, yet it's understood that some elements might not match.

For example, if buttons are a little bit different? well, that's Apple's fault. (I showed that on the Wiki)
But rectangle controls (i.e. placing a list-box or a memo in a tab-control) should actually match.

And I'm 100% sure, that fonts would always look a little bit different on every platform. Because every platform has its own dirty little tricks on how to render a font.

Hansaplast

  • Hero Member
  • *****
  • Posts: 674
  • Tweaking4All.com
    • Tweaking4All
Re: Cocoa - How to get started with helping?
« Reply #68 on: December 30, 2017, 11:07:41 pm »
OK I modified line 486 in CocoaWSStdCitrls.pp (class function TCocoaWSButton.CreateHandle) to :


Code: Pascal  [Select][+][-]
  1. btn.adjustFontToControlSize:=false;


And it seemed like there was difference. Then I noticed that the "B" character seemed different.
So I looked in XCode and the font family is called "System" - which I assume is an alias for the actual font (?).
Anyhoo, in Lazarus is simply entered the font name 'System" and ran the test again and noticed that the fonts now look more alike.
See screenshots. Both are with adjustFontToControlSize:=false !


Hansaplast

  • Hero Member
  • *****
  • Posts: 674
  • Tweaking4All.com
    • Tweaking4All
Re: Cocoa - How to get started with helping?
« Reply #69 on: December 31, 2017, 12:43:16 am »
As for the differences in positioning and sizing, I think CocoaWS might need a little fine tuning.
I'm OK with TButton being different - I suppose users could divert to TBitButton inn case they need a little more flexibility.


I'd be happy to test anything you'd like me to test. :D


I've included a screenshot showing another example a positioning issues (obviously not font related).
Not sure if this is to early to mention - just started working on a little project and this is the first thing I ran into ...  :)
I'd be happy to investigate, but I will need a few pointers in the right direction.

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: Cocoa - How to get started with helping?
« Reply #70 on: December 31, 2017, 12:48:53 am »
are you referring that client are of TGroupBox is different for Cocoa and Carbon?

Hansaplast

  • Hero Member
  • *****
  • Posts: 674
  • Tweaking4All.com
    • Tweaking4All
Re: Cocoa - How to get started with helping?
« Reply #71 on: December 31, 2017, 03:10:10 am »
In this example I'm not anchoring or align anything.
So placing straight forward TGroupBox and place (in this example) a TListBox in it. Resize it so it looks "nice", compile and run.
No alignment, no anchoring except of course the default left and bottom.


So I'm referring to the fact that TListbox (in this example) is placed higher (top) and wider (width) than designed.
Since I cannot design in a Cocoa IDE, one would be depending on a proper/reliable design in Carbon.
If I'd correct the design so it looks OK in runtime, then it would break compiling under Carbon, Windows and Linux - since for those the position and size would be wrong.


I've attached the example project.


Hope that makes sense - apologies if I didn't explain that properly.
And: I'd like to express my appreciation for helping out. I totally understand we all have responsibilities outside of Lazarus time (including myself). So I'm definitely not expecting you, or anyone-else for that matter, to drop everything and spend all their time on these issues - but any help would be welcome  :D

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: Cocoa - How to get started with helping?
« Reply #72 on: December 31, 2017, 04:18:11 am »
hmm... can you build an interface in Xcode with groupbox and listbox (actually any other control)
If possible change the color of the embedded control to something different what white (blue or green is the best)

I'm wondering where "top-left" starts in Xcode version of groupbox.

Thoughts: it might be that Carbon-WS metrics doesn't match Cocoa-WS metrics. Thus if Cocoa-WS matches whatever Xcode do - I'm afraid we would stick to it. If Cocoa-WS is showing something completely different OR if Xcode version matches Carbon-WS, then it would clearly indicate a bug in Cocoa-WS.
« Last Edit: December 31, 2017, 04:20:03 am by skalogryz »

Hansaplast

  • Hero Member
  • *****
  • Posts: 674
  • Tweaking4All.com
    • Tweaking4All
Re: Cocoa - How to get started with helping?
« Reply #73 on: December 31, 2017, 09:35:09 pm »
So with XCode (and I haven't done much with it - so I am aNoob when it comes to XCode), the coordinates work different than in Lazarus.
Where in Lazarus (0,0) = top, left corner, in XCode (0,0) means bottom left corner.
Note: I left all default values unless mentioned otherwise for all components in XCode and Lazarus.


In XCode:
I created a form 400 wide and 300 height.


Then I created a "Box" (that's what XCode calls it) - which has
- title = "Title"
- borderstyle = bezel
- width = 360 (planning in 20 space all around the box for easy of calculation)
- height = 260
- left = 20
- bottom = 20 (since XCode flipped the Y axis)
- Box type = primary (there are some options like secondary, old style, custom, etc)


In the box I created a "Scroll view", which has:
- height = 200
- width = 310
- left = 20
- bottom =20
- Under behavior all op the scroll and scrollbar options have been unchecked


The design and runtime appearance are identical (see screenshot).


Note: with all these different options (title, style, bezel, etc) I can imagine this to be very tricky to figure out.


In Lazarus (Carbon IDE - project file attached):
I created a form also 400x300.


I placed a GroupBox;

- title = "Title"
- borderstyle cannot be set
- width = 360
- height = 260
- left = 20
- top = 20 (300 - 260 - 20)
- Box type cannot be set


In the GroupBox I placed a TListBox;
- height = 200
- width = 310
- left = 20
- top =20 (260 - 200 - 20)
- Style = standard



Compiled with CarbonWS: Design and runtime do match.
Compiled with CocoaWS: Design (in Carbon IDE) does not match runtime (top, height and width are off).


Hansaplast

  • Hero Member
  • *****
  • Posts: 674
  • Tweaking4All.com
    • Tweaking4All
Re: Cocoa - How to get started with helping?
« Reply #74 on: December 31, 2017, 09:41:06 pm »
FYI, tested this under Windows as well - just for the fun of it, and here things align correctly (as expected).

 

TinyPortal © 2005-2018