Recent

Author Topic: TForm, TTabControl and mousewheel passing  (Read 3974 times)

TCH

  • Full Member
  • ***
  • Posts: 200
TForm, TTabControl and mousewheel passing
« on: September 04, 2017, 02:30:36 pm »
I have a Form and i have a TabControl on that. I have a MouseEheelUp and MouseWheelDown event assigned to the Form, which works over any element, but not the TabControl, that blocks it. How can i force the TabControl to ignore those events and let the Form do it?

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: TForm, TTabControl and mousewheel passing
« Reply #1 on: September 04, 2017, 02:40:04 pm »
the easy way out would be to assign the form's wheel hnadlers to the pagecontrol.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

Mick

  • Jr. Member
  • **
  • Posts: 51
Re: TForm, TTabControl and mousewheel passing
« Reply #2 on: September 04, 2017, 02:56:09 pm »
Yes, that is the most simple way. But it is only applicable if MousePos is not relevant. In other case translation of the coordinates (ClientToParent) is needed.

TCH

  • Full Member
  • ***
  • Posts: 200
Re: TForm, TTabControl and mousewheel passing
« Reply #3 on: September 04, 2017, 04:19:55 pm »
The problem is, that it needs to compile under Lazarus 1.2.6, where the TTabControl is not yet have MouseWheel events. So i cannot assign the Form's MouseWheel events to the TTabControl's.

Is there any other way?

Mick

  • Jr. Member
  • **
  • Posts: 51
Re: TForm, TTabControl and mousewheel passing
« Reply #4 on: September 04, 2017, 04:31:18 pm »
Probably only by subclassing the TTabControl (writing your own descendant of the TTabControl component).
Or maybe with some message handling hacks.
Why do you need to compile with that ancient version?

TCH

  • Full Member
  • ***
  • Posts: 200
Re: TForm, TTabControl and mousewheel passing
« Reply #5 on: September 04, 2017, 04:49:37 pm »
Because i would like to support PowerPC OSX and the latest Lazarus on that is 1.2.6.

Mick

  • Jr. Member
  • **
  • Posts: 51
Re: TForm, TTabControl and mousewheel passing
« Reply #6 on: September 04, 2017, 05:56:47 pm »
Ok, then you are excused ;)
I don't know anything about that MacOSX's widgetset, so I'm afraid I can't help.
But the first thing that comes to my mind is to look into the sources of the newer implementations of TTabControl and based on that maybe try to write your own subclass?

TCH

  • Full Member
  • ***
  • Posts: 200
Re: TForm, TTabControl and mousewheel passing
« Reply #7 on: September 04, 2017, 10:10:59 pm »
Ah, a fellow PowerPC fan, i presume. :)
It's not the OSX widgetset, the Lazarus IDE makes the entire GUI programming transparent. The problem is, that Lazarus 1.2.6 does not supports those events. Thanks for the tip, i'll check the sources and if it's not out of my expertise, i'll implement the corresponding parts.

However, if it is, then i think, the best is if i just put some marcos to rule those functions out. However, the LFM will still contain them. Is it possible to use macros in the LFM?

Mick

  • Jr. Member
  • **
  • Posts: 51
Re: TForm, TTabControl and mousewheel passing
« Reply #8 on: September 05, 2017, 12:48:33 am »
Yeah, you've got me. :) I've touched a Mac once. Or maybe twice. :)

We are thinking about the same thing, but naming these things differently. For me it's not the IDE itself that makes the GUI programming transparent (multiplatform). It's the LCL. One of the parts of LCL are widgetsets - the intermediates between a platform-inpedentent sourcecode (components) and platform-specific system functions (OS native GUI). Isn't it that way? In your case I assume that the we are talking about the LCL widgetset for Carbon.

Anyway, as for my suggestion - give it a try. I don't get the idea with LFM. If you will be able to add the mousewheel events in a new subclass, then you will need to replace your old TTabControl with the new one and just add the new handlers at designtime. Or set them at runtime by assigning the event handler procedure.

TCH

  • Full Member
  • ***
  • Posts: 200
Re: TForm, TTabControl and mousewheel passing
« Reply #9 on: September 05, 2017, 09:55:52 am »
Yes you are right, it's the LCL, not the IDE.

Well, that means, that on 1.6.4 i'll need to use TTabControl and on 1.2.6, TTabControl2. Then i still would need to make a macro branch in the LFM...
But i have an idea, since i only use the TabControl for it's pages, then i simply put it's sub elements to the form and resize the TabControl to be only as high as it's tabs. Then the Form can have it's mouse events and i don't care if the scroll will not work over the tablist.

TCH

  • Full Member
  • ***
  • Posts: 200
Re: TForm, TTabControl and mousewheel passing
« Reply #10 on: September 15, 2017, 08:17:25 pm »
I solved it another way. I got rid of TTabControl entirely and implemented my own tab handling. Works under everywhere. It even has close buttons on the tabs.

http://oscomp.hu/epicz/ytfe/ytfe_screenshot18.png

 

TinyPortal © 2005-2018