Jump to content

Disable control without greying it out


tomatthe
 Share

Recommended Posts

I get the feeling I'm going about this the wrong way, but hoping someone can help me out.

Basically i have a label box with some text in it, and it looks something like below. Right now only the right part of the link is click able because the label control for the Blah Blah part is on top of the Http: part of it. I tried disabling the label control ($GUI_DISABLE) with the BLah Blah text in it, but it turns the text gray which doesn't look very good. Is there some other way I should go about doing this? For the link I'm using some code from these forums, but its basically just another label. Pretty much what i want is to have one label on top of another with the top one click able and the bottom one just text.

Blah blah blah

blah blah

blah blah Http://www.google.com

Link to comment
Share on other sites

tomatthe;

You have been around here long enough (4 years) to know that it's best to post some replicator code. It's probably just label positioning but from the 3 lines of non-code and the brief description you are not giving anyone a fair chance to help you.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

Yeah I was being a bit lazy. They are overlapping labels basically. In this example i would like to be able to click the entire text that says "I want to click this label to open notepad" but that isn't possible because it overlaps the other label. I was trying to use the $GUI_DISABLE option on the first label and that does allow me to click all of the "I want to click this label and open notepad" link but it grays the text in the first label which i don't want.

Kinda thinking there is another option I might be able to use for doing this, or I could create small 1 line labels and break it up, but that doesn't really seem like the best way of doing it.

tks

#include <GUIConstantsEx.au3>

#include <StaticConstants.au3>

#include <WindowsConstants.au3>

#Region ### START Koda GUI section ### Form=

$Form1 = GUICreate("Form1", 625, 200, 315, 111)

$Label1 = GUICtrlCreateLabel("This is a label isn't that special, it runs for a few lines and ends up being about 1/2 across thelabel field longwordhere", 112, 32, 146, 75)

GUICtrlSetColor(-1, 0xFF00FF)

GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")

$Label2 = GUICtrlCreateLabel("I want to click this lable and open notepad", 216, 95, 204, 17)

GUISetState(@SW_SHOW)

#EndRegion ### END Koda GUI section ###

While 1

$nMsg = GUIGetMsg()

Switch $nMsg

Case $GUI_EVENT_CLOSE

Exit

Case $Label2

Run("notepad.exe")

Exit

EndSwitch

WEnd

Link to comment
Share on other sites

If you set background colors on those labels you can see exactly what's wrong. It is indeed the overlap and you will have to move $Label2 out a bit.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

Yeah I was being a bit lazy. They are overlapping labels basically. In this example i would like to be able to click the entire text that says "I want to click this label to open notepad" but that isn't possible because it overlaps the other label. I was trying to use the $GUI_DISABLE option on the first label and that does allow me to click all of the "I want to click this label and open notepad" link but it grays the text in the first label which i don't want.

Kinda thinking there is another option I might be able to use for doing this, or I could create small 1 line labels and break it up, but that doesn't really seem like the best way of doing it.

tks

#include <GUIConstantsEx.au3>

#include <StaticConstants.au3>

#include <WindowsConstants.au3>

#Region ### START Koda GUI section ### Form=

$Form1 = GUICreate("Form1", 625, 200, 315, 111)

$Label1 = GUICtrlCreateLabel("This is a label isn't that special, it runs for a few lines and ends up being about 1/2 across thelabel field longwordhere", 112, 32, 146, 75)

GUICtrlSetColor(-1, 0xFF00FF)

GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")

$Label2 = GUICtrlCreateLabel("I want to click this lable and open notepad", 216, 95, 204, 17)

GUISetState(@SW_SHOW)

#EndRegion ### END Koda GUI section ###

While 1

$nMsg = GUIGetMsg()

Switch $nMsg

Case $GUI_EVENT_CLOSE

Exit

Case $Label2

Run("notepad.exe")

Exit

EndSwitch

WEnd

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 625, 200, 315, 111)
$Label1 = GUICtrlCreateLabel("This is a label isn't that special, it runs for a few lines and ends up being about 1/2 across thelabel field longwordhere", 112, 32, 146, 75)
GUICtrlSetColor(-1, 0xFF00FF)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$Label2 = GUICtrlCreateLabel("I want to click this lable and open notepad", 216, 95, 204, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $GUI_EVENT_PRIMARYDOWN;$Label2
            Opt("MouseCoordMode", 2)
            $mp = MouseGetPos()
            $lp = ControlGetPos($Form1, "", $Label2)
            If inside($mp, $lp) Then
                Run("notepad.exe")
                Exit
            EndIf
    EndSwitch
WEnd


Func inside($pt, $rect)
    If $pt[0] < $rect[0] Or $pt[0] > $rect[0] + $rect[2] Then Return False
    If $pt[1] < $rect[1] Or $pt[1] > $rect[1] + $rect[3] Then Return False
    Return True
EndFunc   ;==>inside
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
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...