Jump to content

Display different image in different tabs of TAB control


Recommended Posts

This is how my code snippet looks like

#include <GDIPlus.au3>
#include <GUIConstants.au3>
#Include <WindowsConstants.au3>


$hMainWindow = GUICreate('USB AIO', 705, 369)
GUISetBkColor(0xFFFFFF)
GUISetState()

GUICtrlCreateTab(172 + 4, 10 + 4, 523 - 8, 349 - 8)

_GDIPlus_Startup ()
$hMainGraphicObject = _GDIPlus_GraphicsCreateFromHWND ($hMainWindow)

;~ Loading images
$ADD_SCRIPT_BUTTON_IMAGE = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Images\Add.png")
$PLAY_SCRIPT_BUTTON_IMAGE = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Images\Play.png")

GUICtrlCreateTabItem('TAB 1')
$ADD_SCRIPT_BUTTON = _GDIPlus_GraphicsDrawImageRectRect($hMainGraphicObject, $ADD_SCRIPT_BUTTON_IMAGE, 0, 0, 80, 80, 190, 40, 80, 80)
GUICtrlCreateTabItem('TAB 2')
$PLAY_SCRIPT_BUTTON = _GDIPlus_GraphicsDrawImageRectRect($hMainGraphicObject, $PLAY_SCRIPT_BUTTON_IMAGE, 0, 0, 80, 80, 190, 120, 80, 80)
GUICtrlCreateTabItem('')

;~ If I uncomment following lines
;~ $ADD_SCRIPT_BUTTON = _GDIPlus_GraphicsDrawImageRectRect($hMainGraphicObject, $ADD_SCRIPT_BUTTON_IMAGE, 0, 0, 80, 80, 190, 40, 80, 80)
;~ $PLAY_SCRIPT_BUTTON = _GDIPlus_GraphicsDrawImageRectRect($hMainGraphicObject, $PLAY_SCRIPT_BUTTON_IMAGE, 0, 0, 80, 80, 190, 120, 80, 80)


 While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
    EndSelect
WEnd

The above script shows a dialog box with two empty tabs. Now, if I comment out the following lines

$ADD_SCRIPT_BUTTON = _GDIPlus_GraphicsDrawImageRectRect($hMainGraphicObject, $ADD_SCRIPT_BUTTON_IMAGE, 0, 0, 80, 80, 190, 40, 80, 80)
$PLAY_SCRIPT_BUTTON = _GDIPlus_GraphicsDrawImageRectRect($hMainGraphicObject, $PLAY_SCRIPT_BUTTON_IMAGE, 0, 0, 80, 80, 190, 120, 80,

@ line no. 16 & 17 & uncomment the same lines @ line no 26 & 27, then both the tabs contain both the images. But what I want is to have the first image in the first tab & the second image in the second. Why is it happening? Is there any way to accomplish it?

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

BTW, I turned "Immediate Notification" of topic replies TURNED ON in my profile 7 checked the appropriate check boxes, but didn't get any mail notification of the reply on the thread which I started previously. Does the mail notification work with this board? Since I'm new here, I'm asking it. Please no hard feelings.

Edited by HolmesShelock

[size="2"][font="arial, verdana, tahoma, sans-serif"]ProtectData - A Data Protection software for floppies[/font][/size] [size="2"][hr][/size][size="2"]Sessionchange - A Windows service capable of tracking session change events[/size][size="2"][b][/b][/size]

Link to comment
Share on other sites

  • Moderators

HolmesShelock,

AutoIt looks after controls created with native commands within the tab structure - as soon as you create controls with UDFs you have to do all the work. :>

Look at the Tabs tutorial in the Wiki to see how to do it. ;)

As to the notification when new posts are added, it works fine for me. :unsure:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Thank you again Melba23. You pointed me to the exact link. Now I understand the second part that why both the images appear on both the tabs. But, I'm still confused about the first part that why NO image is shown in the first case.

[size="2"][font="arial, verdana, tahoma, sans-serif"]ProtectData - A Data Protection software for floppies[/font][/size] [size="2"][hr][/size][size="2"]Sessionchange - A Windows service capable of tracking session change events[/size][size="2"][b][/b][/size]

Link to comment
Share on other sites

  • Moderators

HolmesShelock,

I imagine it is something to do with the layering needed for the tab pages - in my experience images and tabs both do strange things to the expected order of controls. :unsure:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...