AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Gui,2:

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
System Monitor



Joined: 09 Mar 2007
Posts: 401
Location: Unknown

PostPosted: Thu Mar 13, 2008 6:09 pm    Post subject: Gui,2: Reply with quote

I have two different gui's but they mush together when both of them are open. Am I not using the gui, 2: right?
Code:
Gui,2:Add, Button, x6 y10 w290 h90 gAlgebra, Algebra
Gui,2:Add, Button, x6 y110 w290 h90 gParabola, f(x)
Gui,2:Show, h211 w308, Math
Return
;;
Gui, Add, ListView, x6 y10 w380 h160 , When x is ...|%equation% is ...
Gui, Show,h205 w395 , Answers
Gui, add, Button, greload,New Equation
Return

_________________
Back to top
View user's profile Send private message Visit poster's website
dncarac



Joined: 31 Aug 2006
Posts: 64

PostPosted: Thu Mar 13, 2008 6:39 pm    Post subject: Reply with quote

Your posted code only opens the first (2: ). How do you open the other?

I amended your code as follows:
Code:
Gui,2:Add, Button, x6 y10 w290 h90 gAlgebra, Algebra
Gui,2:Add, Button, x6 y110 w290 h90 gParabola, f(x)
Gui,2:Show, h211 w308, Math
;Return
;;
Gui, Add, ListView, x6 y10 w380 h160 , When x is ...|%equation% is ...
Gui, Show,h205 w395 , Answers
Gui, add, Button, greload,New Equation
Return

Algebra:
Parabola:
reload:
Return

and the two windows seem to open separately and correctly, though on top of each other. If that is what you mean by "mush together" then you can check out the x and y parameters in the "Gui, Show" command to separate them.

DNC
Back to top
View user's profile Send private message
System Monitor



Joined: 09 Mar 2007
Posts: 401
Location: Unknown

PostPosted: Thu Mar 13, 2008 6:48 pm    Post subject: Reply with quote

I only included the code for the gui
Here is all of the code
Code:
#NoEnv
#SingleInstance, Force
SetBatchlines -1
minaddhowmuch := 1
Gui,2:Add, Button, x6 y10 w290 h90 gAlgebra, Algebra
Gui,2:Add, Button, x6 y110 w290 h90 gParabola, f(x)
Gui,2:Show, h211 w308, Math
Return

Algebra:
Inputbox, equation, Equation, Enter a equation
Inputbox, min, Min, Min number in the search proccess`nYour equation was %equation%
Inputbox, max, Max, Max number in the search proccess`nYour equation was %equation%`nThe min number was %min%
howmuch := (1-min+max) + 100 ; how many times to loop
prog := 100/%howmuch%
Loop %howmuch%
{
  ;Progress, %prog%, %min%,, Progress
  StringReplace, eq, equation, x, (%min%), all
  StringSplit,eq,eq,=
  deq := Eval(eq1)
  deq2 := Eval(eq2)
  if deq = %deq2% ; check if each side of the equation equals the same
    goto, answer
  if min + 1 < deq
  {
    min--
    minaddhowmuch := 0.01
  }
  min := min + minaddhowmuch
}
Progress,off
Msgbox, 4, Couldn't Find, Could not find Answer, Do you wish to try again with one more decimal place?
If Msgbox Yes
{
  minaddhowmuch := minaddhowmuch / 100
  gosub, Algebra
}
return

answer:
Progress,off
Msgbox x = %min%
return

Parabola:
Inputbox, equation, Equation, Enter your equation
Inputbox, min, Domain min, Enter the min number in the domain`nYour equation was: %equation%
Inputbox, max, Domain max, Enter the max number in the domain`nYour equation was: %equation%`nMin for domain: %min%
Gui, Add, ListView, x6 y10 w380 h160 , When x is ...|%equation% is ...
Loop % 1-min+max {
  StringReplace num, equation, x, (%min%), all
  num := Eval(num)
  LV_Add("", min, Eval(num))
  min++
}
Gui, Show,h205 w395 , Answers
Gui, add, Button, greload,New Equation
Return

GuiClose:
ExitApp

Reload:
Reload
return

Eval(x) {   ; Evaluate arithmetic expression with numbers, + - / * ( )
   Return Eval#(RegExReplace(x,"-","#")) ; # = subtraction, to distinguish from sign
}

Eval#(x) {  ; Evaluate expression with numbers, + #(subtract) / * ( ). Recurse into (..)
   Return RegExMatch(x,"(.*)\(([^\(\)]+)\)(.*)",y) ? Eval#(y1 . Eval@(y2) . y3) : Eval@(x)
}

Eval@(x) {  ; Evaluate expression with numbers, + #(subtract) / *
   RegExMatch(x,"(.*)(\+|#)(.*)",y)    ; last + or -
   IfEqual y2,+, Return Eval@(y1) + Eval@(y3)
   IfEqual y2,#, Return Eval@(y1) - Eval@(y3)

   RegExMatch(x,"(.*)(\*|/)(.*)",y)    ; last * or /
   IfEqual y2,*, Return Eval@(y1) * Eval@(y3)
   IfEqual y2,/, Return Eval@(y1) / Eval@(y3)

   Return x ? x : 0                    ; empty expression: 0, number: unchanged
}

Numlock::Sendinput,x
End::Sendinput,(
PgDn::Sendinput,)
Pgup::Sendinput,=


The weird thing is that your code seemed to work, when it does not work with my code. Because the only thing that you did was remove the return, which in this case I want.
_________________
Back to top
View user's profile Send private message Visit poster's website
Trikster



Joined: 15 Jul 2007
Posts: 1224
Location: Enterprise, Alabama

PostPosted: Fri Mar 14, 2008 12:01 am    Post subject: Reply with quote

Code:
#NoEnv
#SingleInstance, Force
SetBatchlines -1
minaddhowmuch := 1
Gui, Add, Button, x6 y10 w290 h90 gAlgebra, Algebra
Gui, Add, Button, x6 y110 w290 h90 gParabola, f(x)
Gui, Show, h211 w308, Math
Return

Algebra:
Inputbox, equation, Equation, Enter a equation
Inputbox, min, Min, Min number in the search proccess`nYour equation was %equation%
Inputbox, max, Max, Max number in the search proccess`nYour equation was %equation%`nThe min number was %min%
howmuch := (1-min+max) + 100 ; how many times to loop
prog := 100/%howmuch%
Loop %howmuch%
{
  ;Progress, %prog%, %min%,, Progress
  StringReplace, eq, equation, x, (%min%), all
  StringSplit,eq,eq,=
  deq := Eval(eq1)
  deq2 := Eval(eq2)
  if deq = %deq2% ; check if each side of the equation equals the same
    goto, answer
  if min + 1 < deq
  {
    min--
    minaddhowmuch := 0.01
  }
  min := min + minaddhowmuch
}
Progress,off
Msgbox, 4, Couldn't Find, Could not find Answer, Do you wish to try again with one more decimal place?
If Msgbox Yes
{
  minaddhowmuch := minaddhowmuch / 100
  gosub, Algebra
}
return

answer:
Progress,off
Msgbox x = %min%
return

Parabola:
Inputbox, equation, Equation, Enter your equation
Inputbox, min, Domain min, Enter the min number in the domain`nYour equation was: %equation%
Inputbox, max, Domain max, Enter the max number in the domain`nYour equation was: %equation%`nMin for domain: %min%
Gui, 2:Add, ListView, x6 y10 w380 h160 , When x is ...|%equation% is ...
Loop % 1-min+max {
  StringReplace num, equation, x, (%min%), all
  num := Eval(num)
  LV_Add("", min, Eval(num))
  min++
}
Gui, 2:add, Button, greload,New Equation
Gui, 2:Show,h205 w395 , Answers
Return

GuiClose:
ExitApp

Reload:
Reload
return

Eval(x) {   ; Evaluate arithmetic expression with numbers, + - / * ( )
   Return Eval#(RegExReplace(x,"-","#")) ; # = subtraction, to distinguish from sign
}

Eval#(x) {  ; Evaluate expression with numbers, + #(subtract) / * ( ). Recurse into (..)
   Return RegExMatch(x,"(.*)\(([^\(\)]+)\)(.*)",y) ? Eval#(y1 . Eval@(y2) . y3) : Eval@(x)
}

Eval@(x) {  ; Evaluate expression with numbers, + #(subtract) / *
   RegExMatch(x,"(.*)(\+|#)(.*)",y)    ; last + or -
   IfEqual y2,+, Return Eval@(y1) + Eval@(y3)
   IfEqual y2,#, Return Eval@(y1) - Eval@(y3)

   RegExMatch(x,"(.*)(\*|/)(.*)",y)    ; last * or /
   IfEqual y2,*, Return Eval@(y1) * Eval@(y3)
   IfEqual y2,/, Return Eval@(y1) / Eval@(y3)

   Return x ? x : 0                    ; empty expression: 0, number: unchanged
}

Numlock::Sendinput,x
End::Sendinput,(
PgDn::Sendinput,)
Pgup::Sendinput,=


I hope you didn't need the first window as GUI 2.
Back to top
View user's profile Send private message
System Monitor



Joined: 09 Mar 2007
Posts: 401
Location: Unknown

PostPosted: Fri Mar 14, 2008 12:12 am    Post subject: Reply with quote

Thx
_________________
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group