Jump to content

help please with this logic


Recommended Posts

#include <GUIConstants.au3>
$set = 0

$GUI = GUICreate("im going crazy!", 560, 490)
GUICtrlCreateTab(0, 22, 560, 460)


$tabinstall = GUICtrlCreateTabItem("INSTALL")
GUICtrlCreateLabel("nuckin futs...", 250, 50)

$d1 = GUICtrlCreateInput("", 140, 240, 30, 20)



GUISetState ()

$msg = 0
While $msg <> $GUI_EVENT_CLOSE
$msg = GUIGetMsg()
   $var1 = StringLen(GuiCtrlRead ($d1))
   If $var1 = 0 And $set = 0 And $msg = $tabinstall Then
      GUICtrlSetState($d1, $GUI_FOCUS)
   EndIf
wend

i dont know if i messed this up, copying and pasting.. i might have missed something.

but pretty much, i have logic that will keep focus on $d1

and then i added some tabs to my gui.. and the buttons on those tabs dont work while focus is being constantly put on $d1

so, i tried to add... logic... "if $var1 = 0 AND $set = 0 AND you are on the correct tab... add focus.

problem is, no focus when i add this.

"And $msg = $tabinstall"

it focuses with just this..

"If $var1 = 0 And $set = 0 Then"

but, then the buttons on the other tabs dont work, because focus keeps getting stolen!

the gui cant tell that im on the install tab... i want an example of some logic, that would allow me to "detect" what tab im on...

hope i didnt overexplain.

what would be the proper way to do this?

Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you.

Link to comment
Share on other sites

i changed it alittle.....

if you place numbers in your input box... focus will stay with $d1

if the box is empty......... focus can go to tab 2 and button 2 works

#include <GUIConstants.au3>
$set = 0

$GUI = GUICreate("im going crazy!", 560, 490)
GUICtrlCreateTab(0, 22, 560, 460)


$tabinstall = GUICtrlCreateTabItem("INSTALL")
GUICtrlCreateLabel("nuckin futs...", 250, 50)

$d1 = GUICtrlCreateInput("", 140, 240, 30, 20)

$tab_2_test = GUICtrlCreateTabItem("TEST")
GUICtrlCreateLabel("nuckin futs... again", 250, 50)

$tab_2_btn = GUICtrlCreateButton("Test Focus", 30, 55, 120, 25)

GUISetState ()

$msg = 0
While $msg <> $GUI_EVENT_CLOSE
    
    
$msg = GUIGetMsg()
   $var1 = StringLen(GuiCtrlRead ($d1))
   If $var1 <> 0 And $set = 0  Then
      GUICtrlSetState($d1, $GUI_FOCUS)
  EndIf
    
    If $msg = $tab_2_btn Then
        MsgBox(0,""," focus is here  ")
    EndIf
  
WEnd

Hope that helps

good luck

NEWHeader1.png

Link to comment
Share on other sites

Maybe even better.........

#include <GUIConstants.au3>

$set = 0

Dim $inp_lbl

$GUI = GUICreate("im going crazy!", 560, 490)

GUICtrlCreateTab(0, 22, 560, 460)

$tabinstall = GUICtrlCreateTabItem("INSTALL")

GUICtrlCreateLabel("nuckin futs...", 250, 50)

$1_btn = GUICtrlCreateButton("Test Input", 30, 55, 120, 25)

$imp_lbl=GUICtrlCreateLabel("Value is not set", 165, 60, 270, 25)

;$d1 = GUICtrlCreateInput("", 140, 240, 30, 20)

$tab_2_test = GUICtrlCreateTabItem("TEST")

GUICtrlCreateLabel("nuckin futs... again", 250, 50)

$2_btn = GUICtrlCreateButton("Test Focus", 30, 55, 120, 25)

GUISetState ()

$msg = 0

While $msg <> $GUI_EVENT_CLOSE

$msg = GUIGetMsg()

; $var1 = StringLen(GuiCtrlRead ($d1))

; If $var1 <> 0 And $set = 0 Then

; GUICtrlSetState($d1, $GUI_FOCUS)

; EndIf

If $msg = $2_btn Then

MsgBox(0,""," focus is here ")

EndIf

If $msg = $1_btn Then

$imp_set=InputBox("Dain Bramage"," PLease type in what you wuckin fant")

If $imp_set <> "" And $set = 0 Then

GUICtrlSetData($imp_lbl , $imp_set)

; call a function ???

Else

MsgBox(0,""," please type in correct info ")

EndIf

EndIf

WEnd

?????????????

NEWHeader1.png

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...