The MASM Forum Archive 2004 to 2012

Specialised Projects => Custom Interface Components => Topic started by: ramguru on August 17, 2007, 10:00:48 PM

Title: GDTabs - custom tabs control
Post by: ramguru on August 17, 2007, 10:00:48 PM
(http://img516.imageshack.us/img516/7152/gdtabsyq9.png)

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]
Title: Re: GDTabs - custom tabs control
Post by: Sameer on August 18, 2007, 11:19:00 AM
excellent work

i needed it

keep up the good work ramguru  :U
Title: Re: GDTabs - custom tabs control
Post by: ramguru on August 18, 2007, 11:23:19 AM
Thanks for your nice feedback :8)
Title: Re: GDTabs - custom tabs control
Post by: Biterider on August 18, 2007, 06:11:41 PM
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
Title: Re: GDTabs - custom tabs control
Post by: ramguru on August 18, 2007, 07:27:01 PM
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.
Title: Re: GDTabs - custom tabs control
Post by: Mark Jones on August 18, 2007, 09:37:29 PM
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+
Title: Re: GDTabs - custom tabs control
Post by: ramguru on August 18, 2007, 09:46:03 PM
: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.
Title: Re: GDTabs - custom tabs control
Post by: ramguru on August 18, 2007, 10:16:29 PM
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
Title: Re: GDTabs - custom tabs control
Post by: Mark Jones on August 19, 2007, 06:00:55 AM
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 (http://developer.nvidia.com/object/nvperfkit_home.html) 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.
Title: Re: GDTabs - custom tabs control
Post by: ramguru on August 19, 2007, 01:39:55 PM
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 (http://www.masm32.com/board/index.php?topic=7784.msg57179#msg57179)  :U
Title: Re: GDTabs - custom tabs control
Post by: Mark Jones on August 19, 2007, 03:08:08 PM
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 (http://msdn2.microsoft.com/en-us/library/ms646265.aspx) is a link to MSDN info, I'll try looking at it more later today when I have time.
Title: Re: GDTabs - custom tabs control
Post by: ramguru on August 19, 2007, 03:19:04 PM
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
Title: Re: GDTabs - custom tabs control
Post by: ramguru on August 20, 2007, 08:20:24 PM
I made a screen-cast (http://geek.php0h.com/GDTabs/GDTabs.html) 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.
Title: Re: GDTabs - custom tabs control
Post by: SideSwipe on August 22, 2007, 05:58:04 AM
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
Title: Re: GDTabs - custom tabs control
Post by: ramguru on August 22, 2007, 06:59:59 AM
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.
Title: Re: GDTabs - custom tabs control
Post by: Jupiter on August 22, 2007, 04:45:09 PM
Hi ramguru
nice to see your another god damn project ;)

I like your screen, but on my system app doesn't work as expected:
arrows don't work;
when switching tabs, buttons aren't switched (only window);
while resizing I got painting artifacts

If you want so, I can take screenshots for each problem.

My system:
DELL Laptop (Core 2 Duo)
ATI Mobility x1400
WinXP MCE SP2 ENG
(I can provide another info if you need it)
Title: Re: GDTabs - custom tabs control
Post by: ramguru on August 22, 2007, 04:54:29 PM
Thanks, Jupiter  :bg
You're my saver:
Now it's fact:

That the problem has nothing to do with video card ('caz there are problem on both manufactures: ati, nvidia),
has nothing to do with OS,
and I could 99% assure that it's not related with my code.

so it's obvious that it's a result of something supernatural.

If to be serious...I'm out of ideas  :lol
Title: Re: GDTabs - custom tabs control
Post by: Jupiter on August 22, 2007, 11:02:40 PM
at least 1% that the problem is related to your code ;)
Title: Re: GDTabs - custom tabs control
Post by: Mark Jones on August 25, 2007, 10:17:37 PM
Hi Ramguru, I'm working on a screen capture for GDTabs, might take a bit yet. I cannot view your video, the page just comes up blank - is there any way to link to the file directly? Maybe if I can save it locally it will work.
Title: Re: GDTabs - custom tabs control
Post by: ramguru on August 25, 2007, 10:30:49 PM
I appreciate your efforts, Mark
Here is link to zip that contains avi

Hot-linking isn't working so you have to copy-paste it
http://geek.php0h.com/gdtabs_Screen_Stream.zip

The previous link was based on flash...
Thanks again.
Title: Re: GDTabs - custom tabs control
Post by: Jupiter on August 26, 2007, 02:15:47 PM
Hi ramguru
I attach archive with screenshots (PNG) with 3 bugs illustrated:
GDTabs_Bug_Resize_H_001.png
GDTabs_Bug_Resize_V_001.png
GDTabs_Bug_Wrong_Selection_001.png

as I already mentioned, <> buttons don't work at all.

[attachment deleted by admin]
Title: Re: GDTabs - custom tabs control
Post by: ramguru on August 26, 2007, 02:19:06 PM
Thanks for this, I hope I can do something to fix that  ::)
Title: Re: GDTabs - custom tabs control
Post by: Mark Jones on August 26, 2007, 09:49:41 PM
Yes I have a problem with flash for some reason. The ActiveX flash-plugin works, but FireFox insists the browser flash-plugin is not installed. Spent a few hours the other day trying to fix it, but gave up after changing registry permissions per Adobe FAQ...

Your capture .avi displays perfectly Ramguru. GDTabs works fine for you, lucky! :-)

Here's my capture in zipped x264/MP2.5 AVI format: Mark-GDTabs (http://heliosstudios.net/temp/Mark-GDTabs.zip)
If you need the decoder, see www.videolan.org/developers/x264.html
I use ffdshow for decoder and configure it to read x264 with "libavcodec."
Title: Re: GDTabs - custom tabs control
Post by: ramguru on August 27, 2007, 08:11:25 AM
Thanks, Mark
I appreciate the time you've spent creating that video  :U wow and even voice (probably yours) - very cool;  :clap:

Quote from: what Mark saidThat's why I said it might have something to do with a ... the mouse position checking code, because it's not noticing that any of this is being highlighted here
I think you made a wrong assumption - mouse position is checked correctly, really, but probably InvalidateRect doesn't invalidate anything, or perhaps SetBrushOrgEx isn't working as expected, or maybe my bitmap split algo isn't doing its stuff. I can only guess, the worst moment is that I cannot make small changes and be sure it will fix these problems, 'cuz I don't see any problem on my PC...but I swear to fix everything :)
Title: Re: GDTabs - custom tabs control
Post by: ramguru on August 27, 2007, 10:48:34 AM
OK I made a little program that may detect what exactly is wrong (small chances of that, but any is better than none :) )

Now please Mark_Jones & Jupiter if you're willing to help run this app and report the results :) thanks in advance.
There are 4 tests to check :)

[attachment deleted by admin]
Title: Re: GDTabs - custom tabs control
Post by: Jupiter on August 27, 2007, 11:13:05 AM
Hi ramguru

Test results:


1. bitmap splitOK
2. SetBrushOrgEx + PatBltOK
3. InvalidateRect 0OK
4. InvalidateRect 1OK

All tests passed OK

P.S. I think that the problem is related to click capture
Title: Re: GDTabs - custom tabs control
Post by: ramguru on August 27, 2007, 11:35:45 AM
Thanks now if you could test this...  :U
?? do still see many issues ??

[attachment deleted by admin]
Title: Re: GDTabs - custom tabs control
Post by: Jupiter on August 27, 2007, 12:34:49 PM
this version is more buggy than previous one ;)

click on tab, switch to another app and return - tab disappears ;)
finally there is no tabs at all - only <> buttons


(http://img146.imageshack.us/img146/3128/gdtabsbugtabsdissaper00nj3.png)
Title: Re: GDTabs - custom tabs control
Post by: ramguru on August 27, 2007, 01:10:43 PM
Thanks, Jupiter
Maybe renaming project from "goddamn" tabs to "god blessed" tabs could solve the problem  :lol
...
I'm starting to lose my patience with this project   :'(
Title: Re: GDTabs - custom tabs control
Post by: Jupiter on August 27, 2007, 01:24:06 PM
Quote from: ramguru on August 27, 2007, 01:10:43 PM
Maybe renaming project from "goddamn" tabs to "god blessed" tabs could solve the problem  :lol
:lol
Holy Tabs ;)

what about creating separate class for buttons itself? it will be much easy to test|debug your code imho
Title: Re: GDTabs - custom tabs control
Post by: Mark Jones on August 27, 2007, 01:49:46 PM
Thanks for looking into this Ramguru. I wish I knew more about GDI so I could help you. Squashing bugs can be tough, but also rewarding. :-)

The problem finder seems to work okay, with one minor artifact seen on test 2 (gray background on right side) which may be nothing, see the attached .png file.

The latest GDTabs works the same as previous for me, except for the new tabs created. If I try to close a new tab using it's little bubble, GDTabs crashes. The crash occurs at address 7c90316c, which is NTDLL.DLL at offset 316c. The exception is "Access violation when writing to [00405000]." This is from GDTabs calling RtlMoveMemory with a size argument of FFFFFFFC.

One other thing I just noticed is that if I try to click a tab, then cover GDTabs with another window, and click GDTabs in the start bar to bring it to the front again, the correct tab will now be shown. This is repeatable. Hope this helps. :U

[attachment deleted by admin]
Title: Re: GDTabs - custom tabs control
Post by: ramguru on August 27, 2007, 02:05:35 PM
Quote from: Mark Jones on August 27, 2007, 01:49:46 PM
with one minor artifact seen on test 2
I see you notice every detail  :U - however, this one is with no importance  :(

Quote from: Mark Jones on August 27, 2007, 01:49:46 PM
If I try to close a new tab using it's little bubble, GDTabs crashes. The crash occurs at address 7c90316c, which is NTDLL.DLL at offset 316c. The exception is "Access violation when writing to [00405000]." This is from GDTabs calling RtlMoveMemory with a size argument of FFFFFFFC.
Yeah I was inattentive, made few mistakes, this was one of them, just hoped everything with drawing will be alright this time - was wrong :)

Quote from: Mark Jones on August 27, 2007, 01:49:46 PM
One other thing I just noticed is that if I try to click a tab, then cover GDTabs with another window, and click GDTabs in the start bar to bring it to the front again, the correct tab will now be shown. This is repeatable. Hope this helps. :U
Thanks for letting me know.
I'm still trying...to fix...
Title: Re: GDTabs - custom tabs control
Post by: ramguru on August 28, 2007, 03:59:02 PM
Finally the millennium bug is fixed  :U (check first post)
Big thanks go to Jupiter & Mark_Jones
Title: Re: GDTabs - custom tabs control
Post by: ragdog on August 28, 2007, 04:28:08 PM
to ramguru

thanks however the first release has by me works on winxpsp2 

great works :U

greets
ragdog
Title: Re: GDTabs - custom tabs control
Post by: Mark Jones on August 28, 2007, 04:29:18 PM
Woohoo that did it! So it was a millennium bug eh? :bg

This may be a difficult request, but do you think it would be possible to incorporate tab-stops on each tab or the tab-bar? That way a blind user or one without a mouse could still use this control. Just an idea, may be too much work. Thanks for working so hard on this. :clap:
Title: Re: GDTabs - custom tabs control
Post by: ramguru on August 28, 2007, 04:35:22 PM
Quote from: Mark Jones on August 28, 2007, 04:29:18 PM
This may be a difficult request, but do you think it would be possible to incorporate tab-stops on each tab or the tab-bar?
I can try...if I succeed it will be in the next release (tab - for next_tab, shift_tab - for previous)

Thanks, ragdog for good words!
Title: Re: GDTabs - custom tabs control
Post by: Shell on August 30, 2007, 03:18:57 AM
Very nice work ramguru  :U

This will definitely come in handy for a skinned app I'm working on  :bg

Thanks
Title: Re: GDTabs - custom tabs control
Post by: Ghirai on September 11, 2007, 02:17:05 PM
Great work :U

Works fine here (XP Pro SP2 32bit, GeForce 8600GT, Core 2 Duo E6550).

As a small suggestion, you could make a tab to also close if you middle-mouse-click on it, possibly an optional feature.
Title: Re: GDTabs - custom tabs control
Post by: hoverlees on October 14, 2007, 10:44:58 AM
WoW! It's very nice!
Title: Re: GDTabs - custom tabs control
Post by: ecube on August 01, 2009, 07:31:44 PM
awesome job :D I found this source years ago to a dll, guy wrote it in masm, it let you visually draw controls, then it'd generate the win api code, I wish I cud find that damn source again, i'd love to add this control to it, and others, so can draw visually.
Title: Re: GDTabs - custom tabs control
Post by: guga on May 15, 2012, 04:48:11 AM
can someone repost it (GDTAbs) please ?

Best Regards,

guga
Title: Re: GDTabs - custom tabs control
Post by: dedndave on May 15, 2012, 01:43:33 PM
i think this is it
Title: Re: GDTabs - custom tabs control
Post by: FORTRANS on May 15, 2012, 09:13:03 PM
Hi Dave,

   I assume that is from Hutch's new archive?  You could just
supply a link to save space?  (What would be nice is if the
"deleted" message supplied the name of the file or a link to it.)

$0.02,

Steve
Title: Re: GDTabs - custom tabs control
Post by: guga on May 15, 2012, 09:42:42 PM
EXcelent work....Many tks
Title: Re: GDTabs - custom tabs control
Post by: dedndave on May 15, 2012, 10:32:54 PM
http://www.masmforum.com/archive2012/4099_GDtabs_4ed.zip

actually, i couldn't find it in the archive my first pass - but there it is   :P
Title: Re: GDTabs - custom tabs control
Post by: jj2007 on May 16, 2012, 08:01:17 AM
Works perfectly with a few changes:

include \masm32\include\masm32rt.inc

DlgProc PROTO :HWND,:UINT,:WPARAM,:LPARAM

; include tabs.inc


:wink