News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

GDTabs - custom tabs control

Started by ramguru, August 17, 2007, 10:00:48 PM

Previous topic - Next topic

ramguru



This is my latest custom control made from zero  :lol
Goddamn Tabs
It supports the following set of messages:


; occurs when new tab is added   ; user sends it
GDTM_ADD       equ WM_USER+1300
; occurs when a tab is closed    ; system sends it
GDTM_CLOSED    equ WM_USER+1301
; occurs when a tab is activated ; system sends it
GDTM_ACTIVATED equ WM_USER+1302
; occurs when an attempt to get text of particular tab is made ; user sends it
GDTM_GETTEXT   equ WM_USER+1303
; occurs when an attempt to set text of particular tab is made ; user sends it
GDTM_SETTEXT   equ WM_USER+1304
; occurs when an attempt to retrieve an index of active tab is made ; user sends it
GDTM_GETACTIVE equ WM_USER+1305


The good thing about this control is that you can draw your own tabs and make them look as you like, and no modifications needed just recompile. Tab's height is estimated by background image height. Tab's or background's width don't matter. Each tab displays up to 10 characters, max 512 tabs there can be.

I haven't made lib or dll, it's up to you to decide how you want it.
Source code & demonstration in the attachment.

Update:
-fixed the millennium bug;
-fixed bug when in one rare case there could appear two selected tabs
-fixed bug when in few rare cases over-state couldn't go off after moving mouse to right
+now GDTM_ACTIVATED returns previous active & current active tabs, so there is no need to hide every window & show one, instead just hide one & show one


[attachment deleted by admin]

Sameer

excellent work

i needed it

keep up the good work ramguru  :U

ramguru

Thanks for your nice feedback :8)

Biterider

Hi ramguru
Very nice work!  :U
Currently I'm working on rewriting some controls from zero.
Maybe I can use your code when I decide to code the Tab control for OA32?

Regards,

Biterider

ramguru

Thanks, Biterider
Of course you can use my code in your projects, everyone are welcome to  :U
BTW. the control uses ATL thunking to support multiple instances. So it maybe hard to analyze the code.
Later after a while I probably will upload some other tab themes.

Mark Jones

Hi Ramguru, I'm having some difficulty with your demo. (I have not had time to test the control for myself yet.) When I run tabs.exe it draws only the two tab arrows on the far left - no tabs. However, the three tabs will appear if I move the window (likely WM_PAINT is called and the buttons are then drawn.) Now the third tab is default selected, and no other tab can be selected. I can click them and the main window contents will change, but the tab highlights do not change. Nor am I able to "add tab." Then the text font of Tab_2 changed to Arabic (I have East Asian font support enabled.) I'll try to look into it more later. XP Pro, AMD XP 2500+
"To deny our impulses... foolish; to revel in them, chaos." MCJ 2003.08

ramguru

:S hmm this is strange, maybe it's 'cuz I'm using brushes & PatBlt, will try to reproduce bugs, to fix...something. Thanks for report Mark.

ramguru

#7
Hey, Mark

Did something change I've updated the attachment

Quote from: Mark Jones on August 18, 2007, 09:37:29 PM
Nor am I able to "add tab."
This was my fault, I didn't remove some debug info...

EDIT> Also what is your video card?
EDIT>> I have:
XP Pro & Amd XP 1800+ & ATI 9500;
XP Pro & Core Duo T2500 & Intel 950GM;
on both systems tabs work fine
and that Arabic font just blows my mind :) have no idea how could it happen

Mark Jones

Quote from: ramguru on August 18, 2007, 10:16:29 PM
Hey, Mark

Did something change I've updated the attachment

Yes that helped a little, now it opens with the tabs displayed, but Tab_3 remains selected and clicking the other tabs still does not "highlight" them. I can add a tab now using the "Add Tab" button, but it will not display until the grey right-arrow button is clicked or the window is moved. Then the right-arrow button changes to the active color, and both arrow buttons "freeze" and do not function as intended. Very strange indeed, especially considering we have similar hardware.

Quote from: ramguru on August 18, 2007, 10:16:29 PM
EDIT> Also what is your video card?
EDIT>> I have:
XP Pro & Amd XP 1800+ & ATI 9500;
XP Pro & Core Duo T2500 & Intel 950GM;
on both systems tabs work fine
and that Arabic font just blows my mind :) have no idea how could it happen

Video card is a 256MB GeForce Fx5600 Ultra. I have the instrumented nVidia drivers installed (which did cause one obscure problem last year, although I forget the details now.) See this for more info about the driver. As for the Arabic font, I think it being Arabic was random and it could have been any font. I can't seem to reproduce it now. But enabling East-Asian Language Support seems to turn on the ability to display anything as a font. For instance it will try to display RadASM language choices in their native fonts even though I do not have those fonts installed. The result is some strange mappings. As for why this would happen to tabs.exe, I have no idea.
"To deny our impulses... foolish; to revel in them, chaos." MCJ 2003.08

ramguru

Thanks for info Mark, but I have no cure for your case yet. Trying to persuade some fox who own NVidia into testing, will see how it goes.

As for today: I made third update, serious one. Check it out  :U

Mark Jones

Hi Ramguru, I've looked at the code somewhat. It seems like the problem likely could be something with TrackMouseEvent, as the tabs do not seem to respond to mouse position as they should. Here is a link to MSDN info, I'll try looking at it more later today when I have time.
"To deny our impulses... foolish; to revel in them, chaos." MCJ 2003.08

ramguru

The problem is that I cannot find any problem in code  :lol but thanks for your time.
I'm using TrackMouseEvent just for one reason: when user moves mouse cursor up in non-client area (caption) or outside its client area there is no way to determine it, but use TrackMouseEvent API. So if it was the case you still would be able to change tabs highlight them with mouse. Just so you know I'm not giving up :)

EDIT> Maybe your video card lacks some kind of GDI acceleration  :green a wild guess  :green2

ramguru

I made a screen-cast demonstrating the control in action. So if you see it not behaving like that please (if you can & have time) upload a screen shot somewhere in imageshack. I still don't know exactly where the problem is.

SideSwipe

Hello:

Great tab control !  I tested it on my PC with Nvidia G-Force 6600 GT, it works just like in the screen-cast movie.

Thanks,

SS
"Crashing through life !"

ramguru

Thanks, SideSwipe
I'm happy to hear you liked it.
It's nice to receive more feedback, and thanks again for info you gave.

Apart from Mark I found one person who's experiencing the same symptoms (he has 7300 GT), so now to end this quest I need to find out what they have in common. Maybe it has to do with their video drivers.