Recent

Author Topic: Problem in drawing controls on TTabSheet  (Read 11900 times)

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: Problem in drawing controls on TTabSheet
« Reply #15 on: July 14, 2018, 03:12:24 am »
My software is free, so if my Mac users have to deal with a few glitches, so be it.

Almost sounds like cringeworthy famous last words.

I should probably know what you're working on, but I don't. Is it something that you could do on the Web? Just wondering.

FPC has a very nice "transpiler" that allows you to write a Web app's frontend in Pascal and convert it to JavaScript. Works quite nicely, although right now it has the feel of some of the other interesting, ambitious stuff that's part of FPC (ppcjvm), that it might not be utilized much.

See Part 4 of the Web App article series here if you have any interest:

https://macpgmr.github.io


Hansaplast

  • Hero Member
  • *****
  • Posts: 674
  • Tweaking4All.com
    • Tweaking4All
Re: Problem in drawing controls on TTabSheet
« Reply #16 on: July 14, 2018, 11:32:36 am »
The various grid components in the grids unit have always been kind of dodgy on Mac since they're custom control and do not simply wrap a Carbon or Cocoa control. TStringGrid in particular has had many problems over the years so this shouldn't be surprising. It might actually need to be fixed in the LCL, not in the Cocoa widgetset.


So what controls should we "Cocoa users" avoid for now, or maybe better said: what controls are the dodgy ones?


I'm running in some weird issues with TPageControl and TListBox when building more complex applications. Some of these issue have been mentioned here, and some have been reported as a bug. Since it appears to happen in more complex applications, and not that much in simple application, I tend to think that I'm doing something wrong in my code.


For example: loss of focus, wheel mouse not working until I actually click the scrollbar, items in ListBox1 changing selection while my mouse is over ListBox2, etc.

Thaddy

  • Hero Member
  • *****
  • Posts: 14201
  • Probably until I exterminate Putin.
Re: Problem in drawing controls on TTabSheet
« Reply #17 on: July 14, 2018, 11:43:36 am »
FPC (ppcjvm), that it might not be utilized much.
ppcjvm is quite mature and I use it a lot. (Because I also use java a lot). But don't expect it to work as a back-end for Lazarus: that's a wrong perception.
I would say its design goal has been achieved. I guess not many Lazarus users use it, probably true, but pure FPC users that also use java probably all use it.
Specialize a type, not a var.

Thaddy

  • Hero Member
  • *****
  • Posts: 14201
  • Probably until I exterminate Putin.
Re: Problem in drawing controls on TTabSheet
« Reply #18 on: July 14, 2018, 11:46:49 am »
So what controls should we "Cocoa users" avoid for now, or maybe better said: what controls are the dodgy ones?
Well, write proper bug reports with sourcecode that reproduce the issues and they will go away...
Focus on the use of controls from which you know there is an underlying native Cocoa control and you should be safe.
Specialize a type, not a var.

VTwin

  • Hero Member
  • *****
  • Posts: 1215
  • Former Turbo Pascal 3 user
Re: Problem in drawing controls on TTabSheet
« Reply #19 on: July 14, 2018, 05:41:15 pm »
My software is free, so if my Mac users have to deal with a few glitches, so be it.

Almost sounds like cringeworthy famous last words.

I should probably know what you're working on, but I don't. Is it something that you could do on the Web? Just wondering.

FPC has a very nice "transpiler" that allows you to write a Web app's frontend in Pascal and convert it to JavaScript. Works quite nicely, although right now it has the feel of some of the other interesting, ambitious stuff that's part of FPC (ppcjvm), that it might not be utilized much.

See Part 4 of the Web App article series here if you have any interest:

https://macpgmr.github.io

Maybe so. :) I maintain several desktop applications for analyzing specialized data sets. I'll send you a link in a pm. Their main use is at universities for research and teaching, but also at some agencies and industries. Several of them are in wide use, but because they are specialized, and there are other free alternatives, I have given up trying to make money on them and am working towards open sourcing them.

There is at least one similar application with a web interface, but most are desktop. I looked into Python, java, and a few other options before committing to Free Pascal. There is at least one similar Python application, but most of my end users don't want to deal with installing all the required libraries. I require a compiler that produces fast code, as I make extensive use of bootstrap statistics and vector graphics. I have therefore preferred compiled code, although I understand java is now quite fast.

Thanks for the link, I had a quick look. I don't know if it would be something I could use. If  I understand, it would require a lot of code on the server side. Also, many of my users are likely to not have a web connection at any given time.
“Talk is cheap. Show me the code.” -Linus Torvalds

Free Pascal Compiler 3.2.2
macOS 12.1: Lazarus 2.2.6 (64 bit Cocoa M1)
Ubuntu 18.04.3: Lazarus 2.2.6 (64 bit on VBox)
Windows 7 Pro SP1: Lazarus 2.2.6 (64 bit on VBox)

VTwin

  • Hero Member
  • *****
  • Posts: 1215
  • Former Turbo Pascal 3 user
Re: Problem in drawing controls on TTabSheet
« Reply #20 on: July 14, 2018, 05:51:15 pm »
I'm running in some weird issues with TPageControl and TListBox when building more complex applications. Some of these issue have been mentioned here, and some have been reported as a bug. Since it appears to happen in more complex applications, and not that much in simple application, I tend to think that I'm doing something wrong in my code.

For example: loss of focus, wheel mouse not working until I actually click the scrollbar, items in ListBox1 changing selection while my mouse is over ListBox2, etc.

Make sure that you are using the current 1.9 trunk version. Many bugs have been fixed, including some mentioned here. It will then be very helpful if you can isolate any bugs in a simple program and report them. I am attempting to do the same.
“Talk is cheap. Show me the code.” -Linus Torvalds

Free Pascal Compiler 3.2.2
macOS 12.1: Lazarus 2.2.6 (64 bit Cocoa M1)
Ubuntu 18.04.3: Lazarus 2.2.6 (64 bit on VBox)
Windows 7 Pro SP1: Lazarus 2.2.6 (64 bit on VBox)

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: Problem in drawing controls on TTabSheet
« Reply #21 on: July 14, 2018, 06:00:35 pm »
Thanks for the link, I had a quick look. I don't know if it would be something I could use. If  I understand, it would require a lot of code on the server side. Also, many of my users are likely to not have a web connection at any given time.

Yikes, are they hunter-gatherers? Most people have Internet access at all times via phone or, say, iPad with cell modem.

The idea is you put much of your current apps' code on the server, maybe as a dynamic library. This assume you designed your app correctly, with a strict separation of UI and non-UI code.

Putting non-UI code in a dynamic library means it can go just about anywhere (desktop, server, mobile) and used with just about any language.

The UI code then is specific to the Web app and will be JavaScript ultimately (can start with Pascal and transpile). Plus something in between which relays the browser-entered data to the server app and returns the server response. This can be something as simple as a CGI app that runs on the server and which you can create with about 20 lines of code with FPC.

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: Problem in drawing controls on TTabSheet
« Reply #22 on: July 14, 2018, 06:05:21 pm »
For example: loss of focus, wheel mouse not working until I actually click the scrollbar, items in ListBox1 changing selection while my mouse is over ListBox2, etc.

TListBox might be a good control to start with and thoroughly investigate, creating test apps and reporting bugs.

Certainly there's something odd about the scroll bars in a TListBox with Cocoa widgetset.

Also, TListBox on Cocoa does not scroll to the item when you set ItemIndex like it does with win32 and carbon widgetsets. Carbon used to have this problem but was fixed within the last year or two - maybe look for the closed bug report.

Plus whatever issues you've already seen with TListBox - I haven't the ones you mention.

VTwin

  • Hero Member
  • *****
  • Posts: 1215
  • Former Turbo Pascal 3 user
Re: Problem in drawing controls on TTabSheet
« Reply #23 on: July 14, 2018, 09:29:11 pm »
Thanks for the link, I had a quick look. I don't know if it would be something I could use. If  I understand, it would require a lot of code on the server side. Also, many of my users are likely to not have a web connection at any given time.

Yikes, are they hunter-gatherers? Most people have Internet access at all times via phone or, say, iPad with cell modem.

The idea is you put much of your current apps' code on the server, maybe as a dynamic library. This assume you designed your app correctly, with a strict separation of UI and non-UI code.

Putting non-UI code in a dynamic library means it can go just about anywhere (desktop, server, mobile) and used with just about any language.

The UI code then is specific to the Web app and will be JavaScript ultimately (can start with Pascal and transpile). Plus something in between which relays the browser-entered data to the server app and returns the server response. This can be something as simple as a CGI app that runs on the server and which you can create with about 20 lines of code with FPC.

 :) Not exactly "hunter-gatherers", but field scientists working in remote locations using a laptop without web or cell service. This is less and less the case, but it is still not uncommon in my field.

I try to keep UI and non-UI code separate, it is reasonably clean. It is true that most of the time most users have web access, so adding a web application could make sense. I'll have a look at your excellent tutorials.
« Last Edit: July 14, 2018, 09:30:46 pm by VTwin »
“Talk is cheap. Show me the code.” -Linus Torvalds

Free Pascal Compiler 3.2.2
macOS 12.1: Lazarus 2.2.6 (64 bit Cocoa M1)
Ubuntu 18.04.3: Lazarus 2.2.6 (64 bit on VBox)
Windows 7 Pro SP1: Lazarus 2.2.6 (64 bit on VBox)

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: Problem in drawing controls on TTabSheet
« Reply #24 on: July 14, 2018, 09:51:54 pm »
It is true that most of the time most users have web access, so adding a web application could make sense.

A good solution when you need more than just a phone's screen is an iPad with a cell modem. The data plans for iPads can be quite reasonable. Cyclists and people who need to look at maps in their Web browsers often use iPads.

wp

  • Hero Member
  • *****
  • Posts: 11855
Re: Problem in drawing controls on TTabSheet
« Reply #25 on: July 14, 2018, 10:00:08 pm »
Sorry if my post is nonsense - I must confess that I did not read everything in detail. From the first post I get the point that the OP wants to create a multipage form using a PageControl with hidden tabs and a Listbox to select the pages.

While this works in Windows it does not work in Linux, too. Therefore I favor the solution with a TNotebook instead of a TPageControl - it does not have any tabs and seems to be predestined for such a task. Please run the attached demo and report if it works for Cocoa (I don't have a Mac).

When designing the Notebook contents add as many pages as there are list box items (right-click on notebook, "Add page"). To navigate between pages use the object tree above the object inspector which lists every page under the notebook node.

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: Problem in drawing controls on TTabSheet
« Reply #26 on: July 14, 2018, 10:05:54 pm »
While this works in Windows it does not work in Linux, too. Therefore I favor the solution with a TNotebook instead of a TPageControl - it does not have any tabs and seems to be predestined for such a task. Please run the attached demo and report if it works for Cocoa (I don't have a Mac).

Yes, per your description, it appears to work fine on Mac with 64-bit Cocoa widgetset.

VTwin

  • Hero Member
  • *****
  • Posts: 1215
  • Former Turbo Pascal 3 user
Re: Problem in drawing controls on TTabSheet
« Reply #27 on: August 16, 2018, 05:34:56 pm »
Sorry if my post is nonsense - I must confess that I did not read everything in detail. From the first post I get the point that the OP wants to create a multipage form using a PageControl with hidden tabs and a Listbox to select the pages.

While this works in Windows it does not work in Linux, too. Therefore I favor the solution with a TNotebook instead of a TPageControl - it does not have any tabs and seems to be predestined for such a task. Please run the attached demo and report if it works for Cocoa (I don't have a Mac).

When designing the Notebook contents add as many pages as there are list box items (right-click on notebook, "Add page"). To navigate between pages use the object tree above the object inspector which lists every page under the notebook node.

Thanks wp. Sorry not to reply earlier, I have not checked in for a while. I have been using the TPageControl for cross-platform programs, and have not run into any problems with it on Linux. Your suggestion to use a TNotebook may be a better solution though. Thanks for testing it Phil.
“Talk is cheap. Show me the code.” -Linus Torvalds

Free Pascal Compiler 3.2.2
macOS 12.1: Lazarus 2.2.6 (64 bit Cocoa M1)
Ubuntu 18.04.3: Lazarus 2.2.6 (64 bit on VBox)
Windows 7 Pro SP1: Lazarus 2.2.6 (64 bit on VBox)

VTwin

  • Hero Member
  • *****
  • Posts: 1215
  • Former Turbo Pascal 3 user
Re: Problem in drawing controls on TTabSheet
« Reply #28 on: August 16, 2018, 05:46:43 pm »
Searching the web, I find:

http://lists.lazarus.freepascal.org/pipermail/lazarus/2010-March/049953.html

which suggests that TNotebook is a custom control, so does not need to have a matching widget. That might be a good reason to use it, as wp suggests, when the native tabbed look is not needed (as in my case). 
« Last Edit: August 16, 2018, 05:50:17 pm by VTwin »
“Talk is cheap. Show me the code.” -Linus Torvalds

Free Pascal Compiler 3.2.2
macOS 12.1: Lazarus 2.2.6 (64 bit Cocoa M1)
Ubuntu 18.04.3: Lazarus 2.2.6 (64 bit on VBox)
Windows 7 Pro SP1: Lazarus 2.2.6 (64 bit on VBox)

VTwin

  • Hero Member
  • *****
  • Posts: 1215
  • Former Turbo Pascal 3 user
Re: Problem in drawing controls on TTabSheet
« Reply #29 on: August 16, 2018, 06:06:07 pm »
...but following the thread backwards, I find some suggestions that TNotebook should be dropped. Then at:

http://lazarus-ccr.sourceforge.net/docs/lcl/extctrls/multi-pagecontrols.html

I find:

Quote
TTabControl and TPageControl are both descended from TCustomNoteBook (which is in turn descended from TWinControl) and have many inherited properties in common. TPageControl has, in general, more advanced features and is probably intended to replace TNoteBook.

so I don't know exactly what to think now.
“Talk is cheap. Show me the code.” -Linus Torvalds

Free Pascal Compiler 3.2.2
macOS 12.1: Lazarus 2.2.6 (64 bit Cocoa M1)
Ubuntu 18.04.3: Lazarus 2.2.6 (64 bit on VBox)
Windows 7 Pro SP1: Lazarus 2.2.6 (64 bit on VBox)

 

TinyPortal © 2005-2018