Jump to content
Sign in to follow this  
dryan

Graphic control on Tabsheet

Recommended Posts

dryan

Is it possible to put a graphic control on a tabitem?

The AutoIt API for GUICtrlCreateTabItem says "tabitem control cannot be painted (too much code ...)," but I'm not quite sure what that means.

For example, if you uncomment the lines below to create tabs, the graphic doesn't show up anymore. Any ideas?

#include <GUIConstants.au3>
$Form = GUICreate("Test", 400, 300, 300, 300)
;$PageControl = GUICtrlCreateTab(10, 10, 380, 280)
;$TabSheet1 = GUICtrlCreateTabItem("TabSheet1")
$Graphic = GUICtrlCreateGraphic(50, 50, 300, 200)
GUICtrlSetBkColor(-1,0xffffff)
GUICtrlSetColor(-1,0)
GUICtrlSetGraphic(-1,$GUI_GR_COLOR, 0x0000ff,0xff0000)
GUICtrlSetGraphic(-1,$GUI_GR_RECT,50,50, 200,100)
;$TabSheet2 = GUICtrlCreateTabItem("TabSheet2")
;GUICtrlCreateTabItem("")
GUISetState(@SW_SHOW)

While 1
    If GUIGetMsg()=$GUI_EVENT_CLOSE Then Exit
WEnd

Share this post


Link to post
Share on other sites
November

Like this?

#include <GUIConstants.au3>
$Form = GUICreate("Test", 400, 300, 300, 300)
$PageControl = GUICtrlCreateTab(10, 10, 380, 280)
$TabSheet1 = GUICtrlCreateTabItem("TabSheet1")
$Graphic = GUICtrlCreateButton("test", 50, 50, 300, 200)
GUICtrlSetBkColor(-1,0xffffff)
GUICtrlSetColor(-1,0)
;GUICtrlSetGraphic(-1,$GUI_GR_COLOR, 0x0000ff,0xff0000)
;GUICtrlSetGraphic(-1,$GUI_GR_RECT,50,50, 200,100)
$TabSheet2 = GUICtrlCreateTabItem("TabSheet2")
$Graphic2 = GUICtrlCreateButton("test 2", 50, 50, 300, 200)
;GUICtrlCreateTabItem("")
GUISetState(@SW_SHOW)

While 1
    If GUIGetMsg()=$GUI_EVENT_CLOSE Then Exit
WEnd

Old Scriptology

Visual Ping 1.8 - Mass Ping Program with export to txt delimited.

Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code.

Desktop 2 RGB - Pick a color in the desktop and get the RGB code.

ShootIT 1.0 - Screen Capture full and partial screen

[font="'Arial Black';"]Remember Remember The Fifth of November.[/font]

Share this post


Link to post
Share on other sites
dryan

Yep, exactly like that, except instead of buttons I want to put a graphic control on the tab.

The problem is the graphic control doesn't show up when I have it on a tab.

Edited by dryan

Share this post


Link to post
Share on other sites
dryan

Yeah, that's the problem.

When I do that, it is as if the graphic control gets put behind the tab (instead of on top of it) as shown in the code below.

If you change the position of the graphics object so it is outside of the tab, you'll be able to see it.

For example, change the x-position of the graphics object to zero and you'll see it come out the side of the tab.

#include <GUIConstants.au3>
$Form = GUICreate("Test", 400, 300, 300, 300)
$PageControl = GUICtrlCreateTab(10, 10, 380, 280)
$TabSheet1 = GUICtrlCreateTabItem("TabSheet1")
$Graphic = GUICtrlCreateGraphic(50, 50, 300, 200) ;Change 1st parameter to 0.
GUICtrlSetBkColor(-1,0xffffff)
GUICtrlSetColor(-1,0)
GUICtrlSetGraphic(-1,$GUI_GR_COLOR, 0x0000ff,0xff0000)
GUICtrlSetGraphic(-1,$GUI_GR_RECT,0,0, 200,100)
$TabSheet2 = GUICtrlCreateTabItem("TabSheet2")
GUICtrlCreateTabItem("")
GUISetState(@SW_SHOW)

While 1
    If GUIGetMsg()=$GUI_EVENT_CLOSE Then Exit
WEnd

Share this post


Link to post
Share on other sites
November

I think that you should pay attention in the gui order .

Cheers


Old Scriptology

Visual Ping 1.8 - Mass Ping Program with export to txt delimited.

Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code.

Desktop 2 RGB - Pick a color in the desktop and get the RGB code.

ShootIT 1.0 - Screen Capture full and partial screen

[font="'Arial Black';"]Remember Remember The Fifth of November.[/font]

Share this post


Link to post
Share on other sites
dryan

Good idea, november, but I don't see a problem with the order.

When a button is used instead of the graphics control, it shows up just fine.

I think it has to do with what the API says about tabitem, "tabitem control cannot be painted (too much code ...)."

Share this post


Link to post
Share on other sites
November

Good idea, november, but I don't see a problem with the order.

When a button is used instead of the graphics control, it shows up just fine.

I think it has to do with what the API says about tabitem, "tabitem control cannot be painted (too much code ...)."

You have to design controls for each tab

Tab - design

Next tab - next design

And so on!

I think that should od the trick!


Old Scriptology

Visual Ping 1.8 - Mass Ping Program with export to txt delimited.

Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code.

Desktop 2 RGB - Pick a color in the desktop and get the RGB code.

ShootIT 1.0 - Screen Capture full and partial screen

[font="'Arial Black';"]Remember Remember The Fifth of November.[/font]

Share this post


Link to post
Share on other sites
dryan

I appreciate everyone's quick responses, but I must not be explaining the problem clearly enough.

I can put other objects on the tabs and it works just fine. When I put a graphic control on it, it doesn't show up on the tabs.

I'm going to give you two pieces of code:

The first has a graphic control that moves to the right when you click the button.

The second is the EXACT same code, except the graphic control is replaced by a button.

Try them to see what I mean.

#include <GUIConstants.au3>
$Form = GUICreate("Test", 410, 300, 300, 300)
$PageControl = GUICtrlCreateTab(150, 10, 250, 280)
$TabSheet1 = GUICtrlCreateTabItem("TabSheet1")
$Graphic = GUICtrlCreateGraphic(15, 75, 120, 200)
GUICtrlSetBkColor(-1,0xffffff)
GUICtrlSetColor(-1,0)
GUICtrlSetGraphic(-1,$GUI_GR_COLOR, 0x0000ff,0xff0000)
GUICtrlSetGraphic(-1,$GUI_GR_RECT,5,5, 65,100)
$Button = GUICtrlCreateButton("Move the graphic located on TabSheet1.", 165, 45, 225, 22)
$TabSheet2 = GUICtrlCreateTabItem("TabSheet2")

GUICtrlCreateTabItem("")
GUISetState(@SW_SHOW)

$toggle = 1
While 1
    $msg = GUIGetMsg()
    If $msg=$GUI_EVENT_CLOSE Then
        Exit
    ElseIf $msg=$Button Then
        GUICtrlSetPos($Graphic,Mod($toggle,4)*50+15, 75, 120, 200)
        $toggle += 1
    EndIf
WEndoÝ÷ Ù«­¢+Ø¥¹±Õ±ÐíU%
½¹ÍѹÑ̹ÔÌÐì(ÀÌØí½É´ôU%
ÉÑ ÅÕ½ÐíQÍÐÅÕ½Ðì°ÐÄÀ°ÌÀÀ°ÌÀÀ°ÌÀÀ¤(ÀÌØíA
½¹Ñɽ°ôU%
Ñɱ
ÉÑQ ÄÔÀ°ÄÀ°ÈÔÀ°ÈàÀ¤(ÀÌØíQM¡ÐÄôU%
Ñɱ
ÉÑQ%Ñ´ ÅÕ½ÐíQM¡ÐÄÅÕ½Ðì¤(ÀÌØíÉÁ¡¥ôU%
Ñɱ
ÉÑ    ÕÑѽ¸ ÅÕ½ÐíÑÍÐÅÕ½Ðì°ÄÔ°ÜÔ°ÄÈÀ°ÈÀÀ¤í   ÕÑѽ¸ÌÌìÌÌìÌÌì(ÀÌØí   ÕÑѽ¸ôU%
Ñɱ
ÉÑ    ÕÑѽ¸ ÅÕ½Ðí5½ÙÑ¡ÉÁ¡¥±½Ñ½¸QM¡ÐĸÅÕ½Ðì°ÄØÔ°ÐÔ°ÈÈÔ°ÈȤ(ÀÌØíQM¡ÐÈôU%
Ñɱ
ÉÑQ%Ñ´ ÅÕ½ÐíQM¡ÐÈÅÕ½Ðì¤()U%
Ñɱ
ÉÑQ%Ñ´ ÅÕ½ÐìÅÕ½Ðì¤)U%MÑMÑÑ¡M]}M!=¤((ÀÌØíѽ±ôÄ)]¡¥±Ä($ÀÌØíµÍôU%Ñ5Í ¤(%ÀÌØíµÍôÀÌØíU%}Y9Q}
1=MQ¡¸($%á¥Ð(%±Í%ÀÌØíµÍôÀÌØí  ÕÑѽ¸Q¡¸($%U%
ÑɱMÑA½Ì ÀÌØíÉÁ¡¥±5½ ÀÌØíѽ±°Ð¤¨ÔÀ¬ÄÔ°ÜÔ°ÄÈÀ°ÈÀÀ¤($$ÀÌØíѽ±¬ôÄ(%¹%)]¹

Share this post


Link to post
Share on other sites
Emiel Wieldraaijer

I've got the same problem ... i'm unable to draw a line onto a TAB

But if you do it like this .. it works on a TAB (Tnx to BigDog)

$SRLine1 = GUICtrlCreateGraphic (30,140,400,1,BitOR($SS_NOTIFY,$SS_SUNKEN))

Edited by Emiel Wieldraaijer

Best regards,Emiel Wieldraaijer

Share this post


Link to post
Share on other sites
AMD

I really wish there was a way around this, as was just trying to get rid of two graph pics by replacing them with a graphiccontrol, but my gui is all tabs.

As 14 lines of code are a heck of alot smaller then installing the two pic files...

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  

×