Jump to content
Sign in to follow this  
Armand

example of: _GUICtrlTab_SetItemImage with real .bmps, [SOLVED]

Recommended Posts

Armand

well... as it says... i've been trying to play around with it... but i can't understand that _WINAPI() functions...

if anyone can provide / link me to an existing example of a TAB control with images... THANKS !!!!

PS, i'll keep on looking, if i'll find anything i'll post the solution for others to come.

Edited by Armand

[u]My Au3 Scripts:[/u]____________(E)Lephant, A Share download manager (RS/MU etc)Http1.1 Console, The Ez Way!Internet Reconnection Automation Suite & A Macro Recording Tool.SK's Alarm Clock, Playing '.MP3 & .Wav' Files._________________Is GOD a mistake of the Humanity Or the Humanity is a mistake of GOD ?!

Share this post


Link to post
Share on other sites
DaRam

This might be a starter:

#include <GUIConstants.au3>

$GuiMain = GUICreate("Main", 633, 447, 193, 115)

$TabCtl_1 = GUICtrlCreateTab(8, 312, 617, 57, $TCS_FIXEDWIDTH)
$TabSheet1 = GUICtrlCreateTabItem("Tab-&1")
   ; Add Controls to this Tab (Sheet)
$TabSheet2 = GUICtrlCreateTabItem("Tab-&2")
    $Pic1 = GUICtrlCreatePic("Drive_and_Path\Test.Bmp", 24, 320, 65, 57, BitOR($SS_NOTIFY,$WS_GROUP))
GUICtrlCreateTabItem("")

While 1
    If GUIGetMsg() = $GUI_EVENT_CLOSE Then
        ExitLoop
    EndIf
WEnd
Edited by DaRam

Share this post


Link to post
Share on other sites
Armand

@DaRam

sorry mate. maybe i was too conspicuous but i meant to put the image in the TAB-ITEM-HEADER not just place it inside the tab item....

i'm still looking BTW... i'm sure i saw one somewhere before... bah.


[u]My Au3 Scripts:[/u]____________(E)Lephant, A Share download manager (RS/MU etc)Http1.1 Console, The Ez Way!Internet Reconnection Automation Suite & A Macro Recording Tool.SK's Alarm Clock, Playing '.MP3 & .Wav' Files._________________Is GOD a mistake of the Humanity Or the Humanity is a mistake of GOD ?!

Share this post


Link to post
Share on other sites
Armand

well... noobish me... i had to look better in the help file... after some [lot] looking around i've found:

#include <GuiConstantsEx.au3>
#include <GuiTab.au3>
#include <WinAPI.au3>
#include <GuiImageList.au3>

Opt('MustDeclareVars', 1)

$Debug_TAB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
    Local $hGUI, $hImage, $hTab

    ; Create GUI
    $hGUI = GUICreate("Tab Control Set Item Image", 400, 300)
    $hTab = GUICtrlCreateTab(2, 2, 396, 296)
    GUISetState()

    ; Create images
    $hImage = _GUIImageList_Create(30, 30)
    ;_GUIImageList_Add($hImage, _WinAPI_CreateSolidBitmap($hGUI, 0xFF0000, 16, 16))
    ;_GUIImageList_Add($hImage, _WinAPI_CreateSolidBitmap($hGUI, 0x00FF00, 16, 16))
    ;_GUIImageList_Add($hImage, _WinAPI_CreateSolidBitmap($hGUI, 0x0000FF, 16, 16))
    
    _GUIImageList_AddBitmap($hImage, @ScriptDir & "\pic1.bmp")
    _GUIImageList_AddBitmap($hImage, @ScriptDir & "\pic2.bmp")
    _GUIImageList_AddBitmap($hImage, @ScriptDir & "\pic3.bmp")
    
    _GUICtrlTab_SetImageList($hTab, $hImage)

    ; Add tabs
    _GUICtrlTab_InsertItem($hTab, 0, "Tab 1")
    _GUICtrlTab_InsertItem($hTab, 1, "Tab 2")
    _GUICtrlTab_InsertItem($hTab, 2, "Tab 3")
    
    ; Get/Set tab 2 image
    _GUICtrlTab_SetItemImage($hTab, 0, 0)
    _GUICtrlTab_SetItemImage($hTab, 1, 1)
    _GUICtrlTab_SetItemImage($hTab, 2, 2)
    
    _GUICtrlTab_SetItemSize($hTab, 70, 40)

    ; Loop until user exits
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUIDelete()
EndFunc   ;==>_Main

is working just fine... just had to replace 3 lines....


[u]My Au3 Scripts:[/u]____________(E)Lephant, A Share download manager (RS/MU etc)Http1.1 Console, The Ez Way!Internet Reconnection Automation Suite & A Macro Recording Tool.SK's Alarm Clock, Playing '.MP3 & .Wav' Files._________________Is GOD a mistake of the Humanity Or the Humanity is a mistake of GOD ?!

Share this post


Link to post
Share on other sites
DaRam

@DaRam

sorry mate. maybe i was too conspicuous but i meant to put the image in the TAB-ITEM-HEADER not just place it inside the tab item....

i'm still looking BTW... i'm sure i saw one somewhere before... bah.

Gotcha :D Here you go, http://www.autoitscript.com/forum/lofivers...php?t15787.html

Instead of populating the Imagelist with Shell32 Icons (ExtractIconEx), you need to modify the AddImageToTab Func to load the BMPs instead.

(not sure if you still need the latest Beta though)

Meanwhile, you found a better example though :D

Edited by DaRam

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×