IonicWind Software

Creative Basic => GUI Programs => Topic started by: Hobo on August 21, 2008, 09:44:24 AM

Title: Please help me out with this very easy question
Post by: Hobo on August 21, 2008, 09:44:24 AM
Somewhere I have to start. Please help me out how to connect with mouse clicked on button (B1) to activate Sub ListBox1.
Eventually I would like to add more buttons that would activate different ListBox sub routines.


DEF win:WINDOW

WINDOW win,0,0,200,300,@MINBOX|@MAXBOX,0," CURVE Wiz",Handler
SETWINDOWCOLOR win,RGB(255,255,0)

'Draw B1'
CONTROL win,"B,B1,5,5,50,20,0,1"

run =  1
WAITUNTIL run=0
CLOSEWINDOW win
END

Handler:
IF @CLASS=@IDCLOSEWINDOW
   run = 0
ENDIF
RETURN

SUB ListBox1
CONTROL win,"E,Curve,120,5,70,20,0,3"
CONTROL win,"E,Curve,120,30,70,20,0,4"
CONTROL win,"T,X=,90,5,30,20,0,5"
SETCONTROLCOLOR win,5,0,rgb(255,255,0)
CONTROL win,"T,Y=,90,30,30,20,0,6"
SETCONTROLCOLOR win,6,0,rgb(255,255,0)
RETURN
Title: Re: Please help me out with this very easy question
Post by: mrainey on August 21, 2008, 11:12:40 AM
Here's one way.  Others will undoubtedly have better ones.


DEF win:WINDOW

WINDOW win,0,0,200,300,@MINBOX|@MAXBOX,0," CURVE Wiz",Handler
SETWINDOWCOLOR win,RGB(255,255,0)

'Draw B1'
CONTROL win,"B,B1,5,5,50,20,0,1"

CONTROL win,"E,Curve,-1000,-1000,70,20,0,3"
CONTROL win,"E,Curve,-1000,-1000,70,20,0,4"
CONTROL win,"T,X=,-1000,-1000,30,20,0,5"
SETCONTROLCOLOR win,5,0,rgb(255,255,0)
CONTROL win,"T,Y=,-1000,-1000,30,20,0,6"

run =  1
WAITUNTIL run=0
CLOSEWINDOW win
END

SUB ListBox1
SETCONTROLCOLOR win,5,0,rgb(255,255,0)
SETCONTROLCOLOR win,6,0,rgb(255,255,0)
SETSIZE win,120,5,70,20,3
SETSIZE win,120,30,70,20,4
SETSIZE win,90,5,30,20,5
SETSIZE win,90,30,30,20,6
RETURN

Handler:
IF @CLASS=@IDCLOSEWINDOW
   run = 0
ENDIF

SELECT @CONTROLID
    CASE 1
       GOSUB ListBox1
ENDSELECT
RETURN
Title: Re: Please help me out with this very easy question
Post by: aurelCB on August 21, 2008, 12:14:18 PM
Here is another way:
DEF win:WINDOW
DEF lbopen:int
WINDOW win,0,0,200,300,@MINBOX|@MAXBOX,0," CURVE Wiz",Handler
SETWINDOWCOLOR win,RGB(255,255,0)

'Draw B1'
CONTROL win,"B,B1,5,5,50,20,0,1"

run =  1
WAITUNTIL run=0
CLOSEWINDOW win
END

Handler:
IF @CLASS=@IDCLOSEWINDOW
   run = 0
ENDIF
IF @CLASS=@IDCREATE
   Centerwindow win
ENDIF
IF @CLASS=@IDCONTROL
IF (@controlid=1)&(lbopen=0)
Gosub Listbox1
ENDIF
ENDIF
RETURN

SUB ListBox1
CONTROL win,"E,Curve,120,5,70,20,0,3"
CONTROL win,"E,Curve,120,30,70,20,0,4"
CONTROL win,"T,X=,90,5,30,20,0,5"
SETCONTROLCOLOR win,5,0,rgb(255,255,0)
CONTROL win,"T,Y=,90,30,30,20,0,6"
SETCONTROLCOLOR win,6,0,rgb(255,255,0)
lbopen=1
RETURN
Title: Re: Please help me out with this very easy question
Post by: aurelCB on August 21, 2008, 12:22:08 PM
And this is third way:

DEF win:WINDOW
DEF listbox1open:int
WINDOW win,0,0,200,300,@MINBOX|@MAXBOX,0," CURVE Wiz",Handler
SETWINDOWCOLOR win,RGB(255,255,0)

'Draw B1'
CONTROL win,"B,B1,5,5,50,20,0,1"

run =  1
WAITUNTIL run=0
CLOSEWINDOW win
END

Handler:
SELECT @CLASS

CASE @IDCLOSEWINDOW
    run = 0

CASE @IDCREATE
    Centerwindow win

CASE @IDCONTROL
IF (@controlid=1)&(listbox1open=0)
Gosub Listbox1
ENDIF

ENDSELECT
RETURN

SUB ListBox1
CONTROL win,"E,Curve,120,5,70,20,0,3"
CONTROL win,"E,Curve,120,30,70,20,0,4"
CONTROL win,"T,X =,90,5,30,20,0,5"
SETCONTROLCOLOR win,5,0,rgb(255,255,0)
CONTROL win,"T,Y =,90,30,30,20,0,6"
SETCONTROLCOLOR win,6,0,rgb(255,255,0)
listbox1open=1
RETURN
Title: Re: Please help me out with this very easy question
Post by: Hobo on August 21, 2008, 03:03:22 PM
Thank you very much both of you. I am going to study these samples you have given to me and hopefully I able to further develop this little program that I would like to create to help my work to do some calculations.

Title: Re: Please help me out with this very easy question
Post by: Hobo on August 21, 2008, 05:02:35 PM
This is great.
I added another button that opens another listbox. It is working except I need a remove command to clear one listbox when I open the other one.
Later I want to put numbers in listboxes and do some calculations with them, but that is later.

Thank you again, and if I am too much anoyance just let me know. :-)


DEF win:WINDOW
DEF listbox1open,listbox2open:int
WINDOW win,0,0,200,300,@MINBOX,0," CURVE Wiz",Handler
SETWINDOWCOLOR win,RGB(255,255,0)

'Draw Button1 & Button2'
CONTROL win,"B,B1,5,5,50,20,0,1"
CONTROL win,"B,B2,5,30,50,20,0,2"

run =  1
WAITUNTIL run=0
CLOSEWINDOW win
END

Handler:
SELECT @CLASS

   CASE @IDCLOSEWINDOW
      run = 0

   CASE @IDCREATE
      Centerwindow win
   
   CASE @IDCONTROL
      IF (@controlid=1)&(listbox1open=0)
      Gosub Listbox1
      ENDIF
      IF (@controlid=2)&(listbox2open=0)
      Gosub Listbox2
      ENDIF

ENDSELECT
RETURN

SUB Listbox1
CONTROL win,"E,CurveX,120,5,70,20,0,3"
CONTROL win,"E,CurveY,120,30,70,20,0,4"
CONTROL win,"T,X =,90,5,30,20,0,5"
SETCONTROLCOLOR win,5,0,rgb(255,255,0)
CONTROL win,"T,Y =,90,30,30,20,0,6"
SETCONTROLCOLOR win,6,0,rgb(255,255,0)
listbox1open=1
RETURN

SUB Listbox2
CONTROL win,"E,CurveA,120,55,70,20,0,7"
CONTROL win,"E,CurveB,120,80,70,20,0,8"
CONTROL win,"T,A =,90,55,30,20,0,9"
SETCONTROLCOLOR win,9,0,rgb(255,255,0)
CONTROL win,"T,B =,90,80,30,20,0,10"
SETCONTROLCOLOR win,10,0,rgb(255,255,0)
listbox2open=1
RETURN
Title: Re: Please help me out with this very easy question
Post by: aurelCB on August 22, 2008, 05:35:15 AM
Hi Hobo ...
No problem if we have time and if we know (...i speak for myself).
You create edit controls no listbox .Listbox is diferent type of control.
I forget yet another way for closing window wich is here.
You can also create controls without subroutines,ordinary after window is open.

'hobo example
DEF win:WINDOW
DEF listbox1open,listbox2open:int
WINDOW win,0,0,200,300,@MINBOX,0," CURVE Wiz",Handler
SETWINDOWCOLOR win,RGB(255,255,0)

'Draw Button1 & Button2'
CONTROL win,"B,B1,5,5,50,20,0,1"
CONTROL win,"B,B2,5,30,50,20,0,2"
'here is change
run =  1
WAITUNTIL win=0
END

Handler:
SELECT @CLASS
'and here
   CASE @IDCLOSEWINDOW
      CLOSEWINDOW win

   CASE @IDCREATE
      Centerwindow win
   
   CASE @IDCONTROL
      IF (@controlid=1)&(listbox1open=0)
      Gosub Listbox1
      ENDIF
      IF (@controlid=2)&(listbox2open=0)
      Gosub Listbox2
      ENDIF

ENDSELECT
RETURN

SUB Listbox1
CONTROL win,"E,CurveX,120,5,70,20,0,3"
CONTROL win,"E,CurveY,120,30,70,20,0,4"
CONTROL win,"T,X =,90,5,30,20,0,5"
SETCONTROLCOLOR win,5,0,rgb(255,255,0)
CONTROL win,"T,Y =,90,30,30,20,0,6"
SETCONTROLCOLOR win,6,0,rgb(255,255,0)
listbox1open=1
RETURN

SUB Listbox2
CONTROL win,"E,CurveA,120,55,70,20,0,7"
CONTROL win,"E,CurveB,120,80,70,20,0,8"
CONTROL win,"T,A =,90,55,30,20,0,9"
SETCONTROLCOLOR win,9,0,rgb(255,255,0)
CONTROL win,"T,B =,90,80,30,20,0,10"
SETCONTROLCOLOR win,10,0,rgb(255,255,0)
listbox2open=1
RETURN
Title: Re: Please help me out with this very easy question
Post by: aurelCB on August 22, 2008, 05:48:55 AM
Oh just one thing.
You can writte gosub command if you wannt or you can writte like this:
IF (@controlid=1)&(listbox1open=0)
Listbox1()
ENDIF
IF (@controlid=2)&(listbox2open=0)
Listbox2()
ENDIF
Same thing. :)
Title: Re: Please help me out with this very easy question
Post by: Hobo on August 22, 2008, 06:08:00 PM
Thanks Aurel and thank you to correct me out with the Edit/List box mix up.

If you have time to look these two programs I wrote in Rapid Q many years ago to help my work. These are .EXE files.
This is what I would like to redo in CB. That is where I am heading.  :)


Title: Re: Please help me out with this very easy question
Post by: aurelCB on August 23, 2008, 05:04:29 AM
Hi here is skeleton for your program:

'hobo example
DEF win:WINDOW
DEF listbox1open,listbox2open:int
WINDOW win,0,0,300,300,@MINBOX,0," CURVE Wiz",Handler
SETWINDOWCOLOR win,RGB(235,235,120)


'create buttons'
CONTROL win,"B,AFF,5,5,60,20,0,1"
SETFONT win, "MS Sans Serif", 9, 400,0,1
CONTROL win,"B,HP / AFF,5,30,60,20,0,2"
SETFONT win, "MS Sans Serif", 9, 400,0,2
CONTROL win,"B,CURVE,5,55,60,20,0,3"
SETFONT win, "MS Sans Serif", 9, 400,0,3
CONTROL win,"B,HP-SCL,5,80,60,20,0,4"
SETFONT win, "MS Sans Serif", 9, 400,0,4
CONTROL win,"B,NPSH,5,105,60,20,0,5"
SETFONT win, "MS Sans Serif", 9, 400,0,5
CONTROL win,"B,TRIM,5,130,60,20,0,6"
SETFONT win, "MS Sans Serif", 9, 400,0,6

CONTROL win,"B,CONV,5,170,60,20,0,7"
SETFONT win, "MS Sans Serif", 9, 400,0,7

CONTROL win,"B,Submit,120,220,80,25,0,8"
SETFONT win, "MS Sans Serif", 9, 400,0,8
'-----------------------------------------
run =  1
WAITUNTIL run=0
CLOSEWINDOW win
END

SUB Handler
SELECT @CLASS

   CASE @IDCLOSEWINDOW
      run=0

   CASE @IDCREATE
      Centerwindow win
   
   CASE @IDCONTROL
      IF (@controlid=1)&(listbox1open=0)
      Listbox1()
      ENDIF
      'IF (@controlid=2)&(listbox2open=0)
      'Listbox2()
      'ENDIF

ENDSELECT
RETURN

'////////////////////////////////////////////////
SUB Listbox1
'create static & edit controls(ID from 11 to 30)
CONTROL win,"E,CurveX,200,70,70,20,0,11"
SETFONT win, "MS Sans Serif", 9, 400,0,11
'---------------------------------------
CONTROL win,"E,CurveY,200,100,70,20,0,12"
SETFONT win, "MS Sans Serif", 9, 400,0,12
'--------------------------------------
CONTROL win,"T,X =,120,70,80,20,0,30"
SETCONTROLCOLOR win,30,0,RGB(235,235,120)
SETFONT win, "MS Sans Serif", 9, 400,0,30
'with this command you change control text
SETCONTROLTEXT win,30,"Wanted RPM"
'----------------------------------------
CONTROL win,"T,Y =,120,100,80,20,0,31"
SETCONTROLCOLOR win,31,0,RGB(235,235,120)
SETFONT win, "MS Sans Serif", 9, 400,0,31
SETCONTROLTEXT win,31,"Enter Old RPM"
'---------------------------------------
'set veriable to one=sub activated
listbox1open=1
'RETURN
LINE win,100,125,280,125
'SUB Listbox2
CONTROL win,"E,CurveA,200,130,70,20,0,13"
SETFONT win, "MS Sans Serif", 9, 400,0,13
CONTROL win,"E,CurveB,200,160,70,20,0,14"
SETFONT win, "MS Sans Serif", 9, 400,0,14
'----------------------------------------
CONTROL win,"T,X =,160,130,30,20,0,32"
SETCONTROLCOLOR win,32,0,RGB(235,235,120)
SETFONT win, "MS Sans Serif", 9, 400,0,32
'----------------------------------------
CONTROL win,"T,Y =,160,160,30,20,0,33"
SETCONTROLCOLOR win,33,0,RGB(235,235,120)
SETFONT win, "MS Sans Serif", 9, 400,0,33
'-----------------------------------
'listbox2open=1
RETURN
Title: Re: Please help me out with this very easy question
Post by: Hobo on August 25, 2008, 11:05:36 AM
Aurelâ€Ã,¦I really thank you for all the help. It is very kind of you to spend time with my little program. I really enjoy study your codes and all.

I downloaded many programs and samples from this site, but I still not finding the right commands I need to complete this program of mine. Would you tell me what command I should use to get input from edit box and show output in edit box, I am thinking numbers? Like â€Ã...“xâ€Ã, button pressed get input form â€Ã...“yâ€Ã,, perhaps â€Ã...“zâ€Ã, edit boxes, then I would do the calculation in a subroutine and then show the output in another edit box.


And I still don’t know how to hide edit boxes. So if I click a button, I would like to clear an existing edit box or boxes.

I don’t ask you to write me the program. If you would just help me with the commands? Just let me know what commands I should play around with?

Perhaps in the near future when I have completed this program, I could share with all of the guys here. Also, it could be a helpful sample for other CB beginners.
Title: Re: Please help me out with this very easy question
Post by: Ionic Wind Support Team on August 25, 2008, 02:02:41 PM
See:  Users Guide - > SetControlText

SetControlText win, 99, ""

If 99 was the ID of your edit control.
Title: Re: Please help me out with this very easy question
Post by: aurelCB on August 25, 2008, 02:45:47 PM
Hi Hobo i undersand what you mean...
Like mr.Paul said first read help.
Last night i spend 2 hours reading help for Rich Edit control and i find solution- i know not very well ::)
So...
Every control you can hide and show.
If you want read contest of edit box you must use command:
text$ = GETCONTROLTEXT (window | dialog, ID)
Of course you must firs define string variable text$ with DEF - or DIM text$ As String if you like this shape.
Second command is :
SETCONTROLTEXT window | dialog, ID, text
and everything woul be ok -- i hope
regards
aurel
Title: Re: Please help me out with this very easy question
Post by: aurelCB on August 25, 2008, 02:58:35 PM
Every control you can hide and show.
I think but i never use hiding controls ,
i only use hide  window -- show window.
Someone else know much about controls then me.
Title: Re: Please help me out with this very easy question
Post by: LarryMc on August 25, 2008, 04:34:55 PM
Hide/show controls is same as windows; you just add the control id on the end

Larry
Title: Re: Please help me out with this very easy question
Post by: Hobo on August 27, 2008, 03:58:06 PM
Thank you all the help.
I think I can do the rest, but again it takes only a bit of information
to to loose rest of your hair. :)
Title: Re: Please help me out with this very easy question
Post by: Hobo on August 27, 2008, 04:18:12 PM
I mean a little bit of information placed in a wrong place or not to placed in the right place,
that all it takes to have nothing.

Thanks again

Hobo
Title: Re: Please help me out with this very easy question
Post by: mrainey on August 27, 2008, 06:44:45 PM
QuoteI mean a little bit of information placed in a wrong place or not to placed in the right place,
that all it takes to have nothing.

Yep, that's programming!   :D
Title: Re: Please help me out with this very easy question
Post by: Hobo on September 04, 2008, 02:31:04 PM
It seems hiding Edit Box only makes the Edit Box invisible, but in real it is still there. That is why I got error in
"SUB add2number" (line 56).

Is there any command to turn Controls on and off? In this case an Edit Box?

I would like a back and forth operation showing Edit Boxes.

'hobo example
DEF win:WINDOW
DEF add2numberopen,add3numberopen:int

WINDOW win,0,0,200,300,@MINBOX,0," CURVE Wiz",Handler
SETWINDOWCOLOR win,RGB(255,255,0)
Centerwindow win

'Draw Buttons'
CONTROL win,"B,Add2Num,5,5,60,20,0,1"
SETFONT win, "MS Sans Serif", 9, 400,0,1
CONTROL win,"B,Add3Num,5,30,60,20,0,2"
SETFONT win, "MS Sans Serif", 9, 400,0,2

run =  1
WAITUNTIL win=0
END

Handler:
SELECT @CLASS

   CASE @IDCLOSEWINDOW
      CLOSEWINDOW win
   
   CASE @IDCONTROL
IF (@controlid=1)&(add3numberopen=1)
showwindow win, @swhide,9
add3numberopen=0
ENDIF
IF (@controlid=1)&(add2numberopen=0)
'showwindow win, @swhide,9
add2number()
ENDIF
IF (@controlid=2)&(add3numberopen=0)
add3number()
    ENDIF

ENDSELECT
RETURN

SUB add2number
CONTROL win,"E,inputX,120,40,70,20,0,3"
CONTROL win,"E,inputY,120,65,70,20,0,4"

LINE win,100,100,190,100

CONTROL win,"E,output,120,115,70,20,0,7"
CONTROL win,"T,Sum =,75,115,30,20,0,8"
SETFONT win, "MS Sans Serif", 9, 400,0,8
SETCONTROLCOLOR win,8,0,rgb(255,255,0)

add2numberopen=1
RETURN

SUB add3number
CONTROL win,"E,inputZ,120,15,70,20,0,9"

add3numberopen=1
RETURN

Title: Re: Please help me out with this very easy question
Post by: LarryMc on September 04, 2008, 03:17:25 PM
See if this is what you're trying to do:'hobo example
DEF win:WINDOW
DEF add2numberopen,add3numberopen:int

WINDOW win,0,0,200,300,@MINBOX,0," CURVE Wiz",Handler
SETWINDOWCOLOR win,RGB(255,255,0)
Centerwindow win

'Draw Buttons'
CONTROL win,"B,Add2Num,5,5,60,20,0,1"
SETFONT win, "MS Sans Serif", 9, 400,0,1
CONTROL win,"B,Add3Num,5,30,60,20,0,2"
SETFONT win, "MS Sans Serif", 9, 400,0,2
'add edit fields
CONTROL win,"E,inputX,120,40,70,20,0,3"
showwindow win, @swhide,3
CONTROL win,"E,inputY,120,65,70,20,0,4"
showwindow win, @swhide,4
CONTROL win,"E,inputZ,120,15,70,20,0,9"
showwindow win, @swhide,9
CONTROL win,"E,output,120,115,70,20,0,7"
showwindow win, @swhide,7
CONTROL win,"T,Sum =,75,115,30,20,0,8"
showwindow win, @swhide,8
SETFONT win, "MS Sans Serif", 9, 400,0,8
SETCONTROLCOLOR win,8,0,rgb(255,255,0)
LINE win,100,100,190,100,RGB(255,255,0)

run =  1
WAITUNTIL win=0
END

Handler:
SELECT @CLASS

   CASE @IDCLOSEWINDOW
      CLOSEWINDOW win
   
   CASE @IDCONTROL
IF (@controlid=1)&(add3numberopen=1)
showwindow win, @swhide,9
add3numberopen=0
ENDIF
IF (@controlid=1)&(add2numberopen=0)
'showwindow win, @swhide,9
add2number()
ENDIF
IF (@controlid=2)&(add3numberopen=0)
add3number()
    ENDIF

ENDSELECT
RETURN

SUB add2number
LINE win,100,100,190,100
showwindow win, @swrestore,3
showwindow win, @swrestore,4
showwindow win, @swhide,9
showwindow win, @swrestore,7
showwindow win, @swrestore,8
add2numberopen=1
RETURN

SUB add3number
LINE win,100,100,190,100
showwindow win, @swrestore,3
showwindow win, @swrestore,4
showwindow win, @swrestore,9
showwindow win, @swrestore,7
showwindow win, @swrestore,8
add3numberopen=1
RETURN


Larry
Title: Re: Please help me out with this very easy question
Post by: Hobo on September 04, 2008, 06:09:24 PM
Yes, that is exactly what I  tried to do. Thank you Larry

So the answer is once you have created the edit box, there is no command to remove it.  Only to manipulate it with @swhide and  @swrestore. Would have been nice to just turn it off and on, because this way even if it is hidden, you still have to deal with its current state. Am I right, or talking nonsense?  :D

Rege
Title: Re: Please help me out with this very easy question
Post by: LarryMc on September 04, 2008, 08:10:33 PM
Now, using windows api's there is a way to delete a control directly; then your re-creating it would not be a problem.

But really, with the code I provided it's not hard to handle the value in the hiden control; just don't do a GETCONTROLTEXT on it if the add 2 flag is set.

Larry
Title: Re: Please help me out with this very easy question
Post by: aurelCB on September 05, 2008, 05:46:58 AM
You can remove edit boxes if you create child window and
every time when you press button close child window then
open with new edit boxes.
Title: Re: Please help me out with this very easy question
Post by: aurelCB on September 05, 2008, 08:24:59 AM
Hi hobo
Here is example:

'hobo example
DEF win:WINDOW
def panel1,panel2:window
def p1,p2:int
DEF listbox1open,listbox2open:int
WINDOW win,0,0,300,300,@MINBOX,0," CURVE Wiz",main
SETWINDOWCOLOR win,RGB(222,222,222)


'create buttons'
CONTROL win,"B,AFF,5,5,60,20,0,1"
SETFONT win, "MS Sans Serif", 9, 400,0,1
CONTROL win,"B,HP / AFF,5,30,60,20,0,2"
SETFONT win, "MS Sans Serif", 9, 400,0,2
CONTROL win,"B,CURVE,5,55,60,20,0,3"
SETFONT win, "MS Sans Serif", 9, 400,0,3
CONTROL win,"B,HP-SCL,5,80,60,20,0,4"
SETFONT win, "MS Sans Serif", 9, 400,0,4
CONTROL win,"B,NPSH,5,105,60,20,0,5"
SETFONT win, "MS Sans Serif", 9, 400,0,5
CONTROL win,"B,TRIM,5,130,60,20,0,6"
SETFONT win, "MS Sans Serif", 9, 400,0,6

CONTROL win,"B,CONV,5,170,60,20,0,7"
SETFONT win, "MS Sans Serif", 9, 400,0,7

CONTROL win,"B,Submit,120,220,80,25,0,8"
SETFONT win, "MS Sans Serif", 9, 400,0,8
'-----------------------------------------
run =  1
WAITUNTIL run=0
CLOSEWINDOW win
END

SUB main
SELECT @CLASS

   CASE @IDCLOSEWINDOW
      run=0

   CASE @IDCREATE
      Centerwindow win
   
   CASE @IDCONTROL
      IF (@controlid=1):'&(listbox1open=0)
      Listbox1()
      ENDIF
      IF (@controlid=2):'&(listbox2open=0)
      Listbox2()
      ENDIF

ENDSELECT
RETURN

'////////////////////////////////////////////////
SUB Listbox1
'If listbox1open=1
' Return
'Endif
If p2=1
closewindow panel2
p2=0
Endif
window panel1,100,20,190,150,@nocaption|@border/2,win,"panel1",main
SETWINDOWCOLOR panel1,RGB(222,222,222)
p1=1
'create static & edit controls(ID from 11 to 30)
CONTROL panel1,"E,,70,20,70,20,0x50800000,11"
SETFONT panel1, "MS Sans Serif", 9, 400,0,11
'---------------------------------------
CONTROL panel1,"E,,70,50,70,20,0x50800000,12"
SETFONT panel1, "MS Sans Serif", 9, 400,0,12
'--------------------------------------
CONTROL panel1,"T,X =,20,70,80,20,0x5000010B,30"
SETCONTROLCOLOR panel1,30,rgb(0,0,0),RGB(222,222,222)
SETFONT panel1, "MS Sans Serif", 9, 400,0,30
'with this command you change control text
SETCONTROLTEXT panel1,30,"Wanted RPM"
'----------------------------------------
CONTROL panel1,"T,Y =,20,100,80,20,0,31"
SETCONTROLCOLOR panel1,31,rgb(0,0,0),RGB(222,222,222)
SETFONT panel1, "MS Sans Serif", 9, 400,0,31
SETCONTROLTEXT panel1,31,"Enter Old RPM"
'---------------------------------------
'set veriable to one=sub activated
listbox1open=1
RETURN

LINE win,100,125,280,125

SUB Listbox2
'If listbox2open=1
' Return
'Endif
If p1=1
closewindow panel1
p1=0
Endif
window panel2,100,20,190,150,@nocaption|@border/2,win,"panel2",main
SETWINDOWCOLOR panel2,RGB(222,222,222)
p2=1
CONTROL panel2,"E,CurveA,70,20,70,20,0,13"
SETFONT panel2, "MS Sans Serif", 9, 400,0,13
CONTROL panel2,"E,CurveB,70,50,70,20,0,14"
SETFONT panel2, "MS Sans Serif", 9, 400,0,14
'----------------------------------------
CONTROL panel2,"T,X =,20,20,30,20,0,32"
SETCONTROLCOLOR panel2,32,0,RGB(222,222,222)
SETFONT panel2, "MS Sans Serif", 9, 400,0,32
'----------------------------------------
CONTROL panel2,"T,Y =,20,50,30,20,0,33"
SETCONTROLCOLOR panel2,33,0,RGB(222,222,222)
SETFONT panel2, "MS Sans Serif", 9, 400,0,33
'-----------------------------------
listbox2open=1
RETURN
Title: Re: Please help me out with this very easy question
Post by: aurelCB on September 05, 2008, 09:38:41 AM
Hi again...
Here is code if you wannt control more then two panels:

'hobo 5 example/by aurel
DEF win:WINDOW
def panel1,panel2:window
def p:int
DEF listbox1open,listbox2open:int
WINDOW win,0,0,300,300,@MINBOX,0," CURVE Wiz",main
SETWINDOWCOLOR win,RGB(222,222,222)


'create buttons'
CONTROL win,"B,AFF,5,5,60,20,0,1"
SETFONT win, "MS Sans Serif", 9, 400,0,1
CONTROL win,"B,HP / AFF,5,30,60,20,0,2"
SETFONT win, "MS Sans Serif", 9, 400,0,2
CONTROL win,"B,CURVE,5,55,60,20,0,3"
SETFONT win, "MS Sans Serif", 9, 400,0,3
CONTROL win,"B,HP-SCL,5,80,60,20,0,4"
SETFONT win, "MS Sans Serif", 9, 400,0,4
CONTROL win,"B,NPSH,5,105,60,20,0,5"
SETFONT win, "MS Sans Serif", 9, 400,0,5
CONTROL win,"B,TRIM,5,130,60,20,0,6"
SETFONT win, "MS Sans Serif", 9, 400,0,6

CONTROL win,"B,CONV,5,170,60,20,0,7"
SETFONT win, "MS Sans Serif", 9, 400,0,7

CONTROL win,"B,Submit,120,220,80,25,0,8"
SETFONT win, "MS Sans Serif", 9, 400,0,8
'-----------------------------------------
run =  1
WAITUNTIL run=0
CLOSEWINDOW win
END

SUB main
SELECT @CLASS

   CASE @IDCLOSEWINDOW
      run=0

   CASE @IDCREATE
      Centerwindow win
   
   CASE @IDCONTROL
      IF (@controlid=1):'&(listbox1open=0)
checkpanel()
      Listbox1()
      ENDIF
      IF (@controlid=2):'&(listbox2open=0)
checkpanel()
      Listbox2()
      ENDIF
'open next panel---------------
'IF (@controlid=3):
' checkpanel()
     ' Listbox3()
     ' ENDIF


ENDSELECT
RETURN

'////////////////////////////////////////////////
SUB Listbox1

window panel1,100,20,190,150,@nocaption|@border/2,win,"panel1",main
SETWINDOWCOLOR panel1,RGB(222,222,222)
p=1
'create static & edit controls(ID from 11 to 30)
CONTROL panel1,"E,,70,20,70,20,0x50800000,11"
SETFONT panel1, "MS Sans Serif", 9, 400,0,11
'---------------------------------------
CONTROL panel1,"E,,70,50,70,20,0x50800000,12"
SETFONT panel1, "MS Sans Serif", 9, 400,0,12
'--------------------------------------
CONTROL panel1,"T,X =,20,70,80,20,0x5000010B,30"
SETCONTROLCOLOR panel1,30,rgb(0,0,0),RGB(222,222,222)
SETFONT panel1, "MS Sans Serif", 9, 400,0,30
'with this command you change control text
SETCONTROLTEXT panel1,30,"Wanted RPM"
'----------------------------------------
CONTROL panel1,"T,Y =,20,100,80,20,0,31"
SETCONTROLCOLOR panel1,31,rgb(0,0,0),RGB(222,222,222)
SETFONT panel1, "MS Sans Serif", 9, 400,0,31
SETCONTROLTEXT panel1,31,"Enter Old RPM"
'---------------------------------------
'set veriable to one=sub activated
listbox1open=1
RETURN

LINE win,100,125,280,125

SUB Listbox2

Endif
window panel2,100,20,190,150,@nocaption|@border/2,win,"panel2",main
SETWINDOWCOLOR panel2,RGB(222,222,222)
p=2
CONTROL panel2,"E,CurveA,70,20,70,20,0,13"
SETFONT panel2, "MS Sans Serif", 9, 400,0,13
CONTROL panel2,"E,CurveB,70,50,70,20,0,14"
SETFONT panel2, "MS Sans Serif", 9, 400,0,14
'----------------------------------------
CONTROL panel2,"T,X =,20,20,30,20,0,32"
SETCONTROLCOLOR panel2,32,0,RGB(222,222,222)
SETFONT panel2, "MS Sans Serif", 9, 400,0,32
'----------------------------------------
CONTROL panel2,"T,Y =,20,50,30,20,0,33"
SETCONTROLCOLOR panel2,33,0,RGB(222,222,222)
SETFONT panel2, "MS Sans Serif", 9, 400,0,33
'-----------------------------------
listbox2open=1
RETURN

SUB checkpanel
'check if you wannt more panels
select p
CASE 1
closewindow panel1
CASE 2
closewindow panel2
'CASE 3
'closewindow panel3
endselect
Return
Title: Re: Please help me out with this very easy question
Post by: Hobo on September 08, 2008, 09:35:39 AM
Hi,â€Ã,¦
Thank you Larry the help and the code. You are right it is not very hard to do the hide/show option, yet my brain goes with Aurel example. I like the idea to turn the panel on and off. It seems it is more straightforward for a future expand.

I am going to code the whole skeleton, then hopefully put some brain to it.

Thank you Aurel and all of you.

Hobo
Title: Re: Please help me out with this very easy question
Post by: Hobo on September 08, 2008, 06:19:21 PM
I am done with the skeleton.

If some of you wonder what I am doing here, here is a little explanation. I work for pump industry and I do a lot of repeating calculation involving RPM, HP, efficiency, flow, head etc. This little program hopefully will do these calculations for me. I want to make it â€Ã...“stay on topâ€Ã, of all other opened windows. It is small, so it takes little place when it is opened.

The code getting a little bit too large. Let me know if it is too big to list here. Larry’s way would have been less in code size, but this way I think it is easier to read.

Thanks again to all who helped me.

Cheers

Hobo

'hobo's Curve Wiz skeleton example/by aurel
DEF win:WINDOW
DEF panel1,panel2,panel3,panel4,panel5,panel6:WINDOW
DEF p:INT
'DEF listbox1open,listbox2open,listbox3open:INT

WINDOW win,0,0,195,250,@MINBOX,0," CURVE Wiz",main
SETWINDOWCOLOR win,RGB(255,255,0)
CENTERWINDOW win


'create buttons'
CONTROL win,"B,AFF,5,5,55,20,0,1"
SETFONT win, "MS Sans Serif", 9, 400,0,1
CONTROL win,"B,HP / AFF,5,30,55,20,0,2"
SETFONT win, "MS Sans Serif", 9, 400,0,2
CONTROL win,"B,CURVE,5,55,55,20,0,3"
SETFONT win, "MS Sans Serif", 9, 400,0,3
CONTROL win,"B,HP-SCL,5,80,55,20,0,4"
SETFONT win, "MS Sans Serif", 9, 400,0,4
CONTROL win,"B,NPSH,5,105,55,20,0,5"
SETFONT win, "MS Sans Serif", 9, 400,0,5
CONTROL win,"B,TRIM,5,130,55,20,0,6"
SETFONT win, "MS Sans Serif", 9, 400,0,6

CONTROL win,"B,CONV,5,170,55,20,0,7"
SETFONT win, "MS Sans Serif", 9, 400,0,7

CONTROL win,"B,Submit,90,190,60,20,0,8"
SETFONT win, "MS Sans Serif", 9, 400,0,8
SETCONTROLCOLOR win,8,rgb(0,0,0),RGB(243,193,0)

'-----------------------------------------
run =  1
WAITUNTIL run=0
CLOSEWINDOW win
END

SUB main
SELECT @CLASS

   CASE @IDCLOSEWINDOW
      run=0
   CASE @IDCONTROL
      IF (@CONTROLID=1)
checkpanel()
      listbox1()
      ENDIF
      IF (@CONTROLID=2)
checkpanel()
    listbox2()
      ENDIF
  IF (@CONTROLID=3)
checkpanel()
    listbox3()
      ENDIF
  IF (@CONTROLID=4)
checkpanel()
    listbox4()
  ENDIF
  IF (@CONTROLID=5)
checkpanel()
    listbox5()
  ENDIF
  IF (@CONTROLID=6)
checkpanel()
    listbox6()
  ENDIF

ENDSELECT
RETURN

'////////////////////////////////////////////////
SUB Listbox1

WINDOW panel1,62,5,150,170,@NOCAPTION|@BORDER/4,win,"panel1",main
SETWINDOWCOLOR panel1,RGB(255,255,0)
p=1
'create static & edit controls(ID from 11 to 18)
CONTROL panel1,"E,AffA,75,55,45,20,0x50800000,11"
SETFONT panel1, "MS Sans Serif", 9, 400,0,11
'---------------------------------------
CONTROL panel1,"E,AffB,75,80,45,20,0x50800000,12"
SETFONT panel1, "MS Sans Serif", 9, 400,0,12
'---------------------------------------
LINE panel1,20,110,180,110
'---------------------------------------
CONTROL panel1,"E,Xbox,75,120,45,20,0x50800000,13"
SETFONT panel1, "MS Sans Serif", 9, 400,0,13
'---------------------------------------
CONTROL panel1,"E,Ybox,75,145,45,20,0x50800000,14"
SETFONT panel1, "MS Sans Serif", 9, 400,0,14
'---------------------------------------
CONTROL panel1,"T,Wanted RPM,6,58,70,20,0x5000010B,15"
SETCONTROLCOLOR panel1,15,rgb(0,0,0),RGB(255,255,0)
SETFONT panel1, "MS Sans Serif", 9, 400,0,15
'----------------------------------------
CONTROL panel1,"T,EnterOld RPM,3,83,70,20,0,16"
SETCONTROLCOLOR panel1,16,rgb(0,0,0),RGB(255,255,0)
SETFONT panel1, "MS Sans Serif", 9, 400,0,16
'----------------------------------------
CONTROL panel1,"T,X = ,52,123,70,20,0,17"
SETCONTROLCOLOR panel1,17,rgb(0,0,0),RGB(255,255,0)
SETFONT panel1, "MS Sans Serif", 9, 400,0,17
'----------------------------------------
CONTROL panel1,"T,Y = ,52,148,70,20,0,18"
SETCONTROLCOLOR panel1,18,rgb(0,0,0),RGB(255,255,0)
SETFONT panel1, "MS Sans Serif", 9, 400,0,18

listbox1open=1
RETURN


SUB Listbox2

WINDOW panel2,62,5,150,170,@NOCAPTION|@BORDER/4,win,"panel2",main
SETWINDOWCOLOR panel2,RGB(255,255,0)
p=2
'create static & edit controls(ID from 21 to 28)
CONTROL panel2,"E,HPAFFBoxA,75,30,45,20,0x50800000,21"
SETFONT panel2, "MS Sans Serif", 9, 400,0,21
'----------------------------------------
CONTROL panel2,"E,HPAFFBoxB,75,55,45,20,0x50800000,22"
SETFONT panel2, "MS Sans Serif", 9, 400,0,22
'----------------------------------------
CONTROL panel2,"E,HPAFFBoxC,75,80,45,20,0x50800000,23"
SETFONT panel2, "MS Sans Serif", 9, 400,0,23
'----------------------------------------
LINE panel2,20,110,180,110
'---------------------------------------
CONTROL panel2,"E,NewHPbox,75,120,45,20,0x50800000,24"
SETFONT panel2, "MS Sans Serif", 9, 400,0,24
'---------------------------------------
CONTROL panel2,"T,Enter Old RPM,2,33,70,20,0x5000010B,25"
SETCONTROLCOLOR panel2,25,rgb(0,0,0),RGB(255,255,0)
SETFONT panel2, "MS Sans Serif", 9, 400,0,25
'----------------------------------------
CONTROL panel2,"T,Wanted RPM,8,58,70,20,0x5000010B,26"
SETCONTROLCOLOR panel2,26,rgb(0,0,0),RGB(255,255,0)
SETFONT panel2, "MS Sans Serif", 9, 400,0,26
'----------------------------------------
CONTROL panel2,"T,Enter Old RPM,2,83,70,20,0x5000010B,27"
SETCONTROLCOLOR panel2,27,rgb(0,0,0),RGB(255,255,0)
SETFONT panel2, "MS Sans Serif", 9, 400,0,27
'----------------------------------------
CONTROL panel2,"T,NEW HP =,15,123,70,20,0,28"
SETCONTROLCOLOR panel2,28,0,RGB(255,255,0)
SETFONT panel2, "MS Sans Serif", 9, 400,0,28
'----------------------------------------
listbox2open=1
RETURN


SUB Listbox3

WINDOW panel3,62,5,150,170,@NOCAPTION|@BORDER/4,win,"panel3",main
SETWINDOWCOLOR panel3,RGB(255,255,0)
p=3
'create static & edit controls(ID from 31 to 38)
CONTROL panel3,"E,CBoxA,75,5,45,20,0,31"
SETFONT panel3, "MS Sans Serif", 9, 400,0,31
'----------------------------------------
CONTROL panel3,"E,CBoxB,75,30,45,20,0,32"
SETFONT panel3, "MS Sans Serif", 9, 400,0,32
'----------------------------------------
CONTROL panel3,"E,CboxC,75,55,45,20,0,33"
SETFONT panel3, "MS Sans Serif", 9, 400,0,33
'----------------------------------------
CONTROL panel3,"E,CboxD,75,80,45,20,0,34"
SETFONT panel3, "MS Sans Serif", 9, 400,0,34
'----------------------------------------
LINE panel3,20,110,180,110
'---------------------------------------
CONTROL panel3,"T,Enter GPM,15,8,70,20,0,35"
SETCONTROLCOLOR panel3,35,0,RGB(255,255,0)
SETFONT panel3, "MS Sans Serif", 9, 400,0,35
'----------------------------------------
CONTROL panel3,"T,Enter Feet,15,33,70,20,0,36"
SETCONTROLCOLOR panel3,36,0,RGB(255,255,0)
SETFONT panel3, "MS Sans Serif", 9, 400,0,36
'-----------------------------------
CONTROL panel3,"T,Enter EFF,15,58,70,20,0,37"
SETCONTROLCOLOR panel3,37,0,RGB(255,255,0)
SETFONT panel3, "MS Sans Serif", 9, 400,0,37
'-----------------------------------
CONTROL panel3,"T,Enter HP,15,83,70,20,0,38"
SETCONTROLCOLOR panel3,38,0,RGB(255,255,0)
SETFONT panel3, "MS Sans Serif", 9, 400,0,38
'-----------------------------------
listbox3open=1
RETURN


SUB Listbox4

WINDOW panel4,62,5,150,170,@NOCAPTION|@BORDER/4,win,"panel4",main
SETWINDOWCOLOR panel4,RGB(255,255,0)
p=4
'create static & edit controls(ID from 41 to 48)
CONTROL panel4,"E,HPSclA,75,55,45,20,0x50800000,41"
SETFONT panel4, "MS Sans Serif", 9, 400,0,41
'---------------------------------------
CONTROL panel4,"E,AHPSclB,75,80,45,20,0x50800000,42"
SETFONT panel4, "MS Sans Serif", 9, 400,0,42
'---------------------------------------
LINE panel4,20,110,180,110
'---------------------------------------
CONTROL panel4,"E,Xbox,75,120,45,20,0x50800000,43"
SETFONT panel4, "MS Sans Serif", 9, 400,0,43
'---------------------------------------
CONTROL panel4,"E,Ybox,75,145,45,20,0x50800000,44"
SETFONT panel4, "MS Sans Serif", 9, 400,0,44
'---------------------------------------
CONTROL panel4,"T,Wanted HP,13,58,70,20,0x5000010B,45"
SETCONTROLCOLOR panel4,45,rgb(0,0,0),RGB(255,255,0)
SETFONT panel4, "MS Sans Serif", 9, 400,0,45
'----------------------------------------
CONTROL panel4,"T,HP Now,28,83,70,20,0,46"
SETCONTROLCOLOR panel4,46,rgb(0,0,0),RGB(255,255,0)
SETFONT panel4, "MS Sans Serif", 9, 400,0,46
'----------------------------------------
CONTROL panel4,"T,X = ,52,123,70,20,0,47"
SETCONTROLCOLOR panel4,47,rgb(0,0,0),RGB(255,255,0)
SETFONT panel4, "MS Sans Serif", 9, 400,0,47
'----------------------------------------
CONTROL panel4,"T,Y = ,52,148,70,20,0,48"
SETCONTROLCOLOR panel4,48,rgb(0,0,0),RGB(255,255,0)
SETFONT panel4, "MS Sans Serif", 9, 400,0,48

listbox4open=1
RETURN


SUB Listbox5

WINDOW panel5,62,5,150,170,@NOCAPTION|@BORDER/4,win,"panel5",main
SETWINDOWCOLOR panel5,RGB(255,255,0)
p=5
'create static & edit controls(ID from 51 to 58)
CONTROL panel5,"E,HPSHA,75,30,45,20,0,51"
SETFONT panel5, "MS Sans Serif", 9, 400,0,51
'----------------------------------------
CONTROL panel5,"E,HPSHB,75,55,45,20,0,52"
SETFONT panel5, "MS Sans Serif", 9, 400,0,52
'----------------------------------------
CONTROL panel5,"E,HPSHC,75,80,45,20,0,53"
SETFONT panel5, "MS Sans Serif", 9, 400,0,53
'----------------------------------------
LINE panel5,20,110,180,110
'---------------------------------------
CONTROL panel5,"E,NewHPbox,75,120,45,20,0x50800000,54"
SETFONT panel5, "MS Sans Serif", 9, 400,0,54
'---------------------------------------
CONTROL panel5,"T,RPM New,20,33,70,20,0x5000010B,55"
SETCONTROLCOLOR panel5,55,rgb(0,0,0),RGB(255,255,0)
SETFONT panel5, "MS Sans Serif", 9, 400,0,55
'----------------------------------------
CONTROL panel5,"T,RPM Old,20,58,70,20,0x5000010B,56"
SETCONTROLCOLOR panel5,56,rgb(0,0,0),RGB(255,255,0)
SETFONT panel5, "MS Sans Serif", 9, 400,0,56
'----------------------------------------
CONTROL panel5,"T,NPSH Old,20,83,70,20,0x5000010B,57"
SETCONTROLCOLOR panel5,57,rgb(0,0,0),RGB(255,255,0)
SETFONT panel5, "MS Sans Serif", 9, 400,0,57
'----------------------------------------
CONTROL panel5,"T,New NPSH =,4,123,70,20,0,58"
SETCONTROLCOLOR panel5,58,0,RGB(255,255,0)
SETFONT panel5, "MS Sans Serif", 9, 400,0,58
'----------------------------------------

listbox5open=1
RETURN


SUB Listbox6

WINDOW panel6,62,5,150,170,@NOCAPTION|@BORDER/4,win,"panel4",main
SETWINDOWCOLOR panel6,RGB(255,255,0)
p=6
'create static & edit controls(ID from 61 to 70)

CONTROL panel6,"E,TrimA,75,30,45,20,0x50800000,61"
SETFONT panel6, "MS Sans Serif", 9, 400,0,61
'----------------------------------------
CONTROL panel6,"E,TrimB,75,55,45,20,0x50800000,62"
SETFONT panel6, "MS Sans Serif", 9, 400,0,62
'---------------------------------------
CONTROL panel6,"E,TrimC,75,80,45,20,0x50800000,63"
SETFONT panel6, "MS Sans Serif", 9, 400,0,63
'---------------------------------------
LINE panel6,20,110,180,110
'---------------------------------------
CONTROL panel6,"E,Xbox,75,120,45,20,0x50800000,64"
SETFONT panel6, "MS Sans Serif", 9, 400,0,64
'---------------------------------------
CONTROL panel6,"E,Ybox,75,145,45,20,0x50800000,65"
SETFONT panel6, "MS Sans Serif", 9, 400,0,65
'---------------------------------------
CONTROL panel6,"T,Enter Feet,22,33,70,20,0,66"
SETCONTROLCOLOR panel6,66,0,RGB(255,255,0)
SETFONT panel6, "MS Sans Serif", 9, 400,0,66
'-----------------------------------
CONTROL panel6,"T,Enter New Trim,2,58,70,20,0x5000010B,67"
SETCONTROLCOLOR panel6,67,rgb(0,0,0),RGB(255,255,0)
SETFONT panel6, "MS Sans Serif", 9, 400,0,67
'----------------------------------------
CONTROL panel6,"T,Correction No.,2,83,70,20,0,68"
SETCONTROLCOLOR panel6,68,rgb(0,0,0),RGB(255,255,0)
SETFONT panel6, "MS Sans Serif", 9, 400,0,68
'----------------------------------------
CONTROL panel6,"T,X = ,52,123,70,20,0,69"
SETCONTROLCOLOR panel6,69,rgb(0,0,0),RGB(255,255,0)
SETFONT panel6, "MS Sans Serif", 9, 400,0,69
'----------------------------------------
CONTROL panel6,"T,Y = ,52,148,70,20,0,70"
SETCONTROLCOLOR panel6,70,rgb(0,0,0),RGB(255,255,0)
SETFONT panel6, "MS Sans Serif", 9, 400,0,70

listbox6open=1
RETURN


SUB checkpanel
'check if you wannt more panels
SELECT p
CASE 1
CLOSEWINDOW panel1
CASE 2
CLOSEWINDOW panel2
CASE 3
CLOSEWINDOW panel3
CASE 4
CLOSEWINDOW panel4
CASE 5
CLOSEWINDOW panel5
CASE 6
CLOSEWINDOW panel6
ENDSELECT
RETURN
Title: Re: Please help me out with this very easy question
Post by: aurelCB on September 09, 2008, 12:05:15 AM
Very good Hobo... ;)
Just one small sugestion,if you want centerwindow faster use:

CASE @IDCLOSEWINDOW
      run=0
CASE @IDCREATE
     Centerwindow win

And one question.Why is main window so small?
Title: Re: Please help me out with this very easy question
Post by: Hobo on September 09, 2008, 12:54:04 AM
I want  the main window stay on the top of all other windows.
So, I want to make the main window very small so it takes very little space.

I don't know how to do that though.  :(
Title: Re: Please help me out with this very easy question
Post by: aurelCB on September 09, 2008, 04:08:42 AM
Oh i see...
You want main window allways on top,ok you dont need centerwindow for this.
Maby next code is interesting for you:

'hobo's Curve Wiz skeleton example/by aurel
DEF win,tw:WINDOW
def runtw:int
DEF panel1,panel2,panel3,panel4,panel5,panel6:WINDOW
DEF p:INT
'DEF listbox1open,listbox2open,listbox3open:INT

WINDOW win,0,0,195,250,@MINBOX,0," CURVE Wiz",main
SETWINDOWCOLOR win,RGB(255,255,0)
OpenToolWin()
'CENTERWINDOW win


'create buttons'
CONTROL win,"B,AFF,5,5,55,20,0,1"
SETFONT win, "MS Sans Serif", 9, 400,0,1
CONTROL win,"B,HP / AFF,5,30,55,20,0,2"
SETFONT win, "MS Sans Serif", 9, 400,0,2
CONTROL win,"B,CURVE,5,55,55,20,0,3"
SETFONT win, "MS Sans Serif", 9, 400,0,3
CONTROL win,"B,HP-SCL,5,80,55,20,0,4"
SETFONT win, "MS Sans Serif", 9, 400,0,4
CONTROL win,"B,NPSH,5,105,55,20,0,5"
SETFONT win, "MS Sans Serif", 9, 400,0,5
CONTROL win,"B,TRIM,5,130,55,20,0,6"
SETFONT win, "MS Sans Serif", 9, 400,0,6

CONTROL win,"B,CONV,5,170,55,20,0,7"
SETFONT win, "MS Sans Serif", 9, 400,0,7

CONTROL win,"B,Submit,90,190,60,20,0,8"
SETFONT win, "MS Sans Serif", 9, 400,0,8
SETCONTROLCOLOR win,8,rgb(0,0,0),RGB(243,193,0)

'-----------------------------------------
run =  1
WAITUNTIL run=0
CLOSEWINDOW win
END

SUB main
SELECT @CLASS

   CASE @IDCLOSEWINDOW
      run=0


   CASE @IDCONTROL
      IF (@CONTROLID=1)
checkpanel()
      listbox1()
      ENDIF
      IF (@CONTROLID=2)
checkpanel()
    listbox2()
      ENDIF
  IF (@CONTROLID=3)
checkpanel()
    listbox3()
      ENDIF
  IF (@CONTROLID=4)
checkpanel()
    listbox4()
  ENDIF
  IF (@CONTROLID=5)
checkpanel()
    listbox5()
  ENDIF
  IF (@CONTROLID=6)
checkpanel()
    listbox6()
  ENDIF

ENDSELECT
RETURN

'////////////////////////////////////////////////
SUB Listbox1

WINDOW panel1,62,5,150,170,@NOCAPTION|@BORDER/4,win,"panel1",main
SETWINDOWCOLOR panel1,RGB(255,255,0)
p=1
'create static & edit controls(ID from 11 to 18)
CONTROL panel1,"E,AffA,75,55,45,20,0x50800000,11"
SETFONT panel1, "MS Sans Serif", 9, 400,0,11
'---------------------------------------
CONTROL panel1,"E,AffB,75,80,45,20,0x50800000,12"
SETFONT panel1, "MS Sans Serif", 9, 400,0,12
'---------------------------------------
LINE panel1,20,110,180,110
'---------------------------------------
CONTROL panel1,"E,Xbox,75,120,45,20,0x50800000,13"
SETFONT panel1, "MS Sans Serif", 9, 400,0,13
'---------------------------------------
CONTROL panel1,"E,Ybox,75,145,45,20,0x50800000,14"
SETFONT panel1, "MS Sans Serif", 9, 400,0,14
'---------------------------------------
CONTROL panel1,"T,Wanted RPM,6,58,70,20,0x5000010B,15"
SETCONTROLCOLOR panel1,15,rgb(0,0,0),RGB(255,255,0)
SETFONT panel1, "MS Sans Serif", 9, 400,0,15
'----------------------------------------
CONTROL panel1,"T,EnterOld RPM,3,83,70,20,0,16"
SETCONTROLCOLOR panel1,16,rgb(0,0,0),RGB(255,255,0)
SETFONT panel1, "MS Sans Serif", 9, 400,0,16
'----------------------------------------
CONTROL panel1,"T,X = ,52,123,70,20,0,17"
SETCONTROLCOLOR panel1,17,rgb(0,0,0),RGB(255,255,0)
SETFONT panel1, "MS Sans Serif", 9, 400,0,17
'----------------------------------------
CONTROL panel1,"T,Y = ,52,148,70,20,0,18"
SETCONTROLCOLOR panel1,18,rgb(0,0,0),RGB(255,255,0)
SETFONT panel1, "MS Sans Serif", 9, 400,0,18

listbox1open=1
RETURN


SUB Listbox2

WINDOW panel2,62,5,150,170,@NOCAPTION|@BORDER/4,win,"panel2",main
SETWINDOWCOLOR panel2,RGB(255,255,0)
p=2
'create static & edit controls(ID from 21 to 28)
CONTROL panel2,"E,HPAFFBoxA,75,30,45,20,0x50800000,21"
SETFONT panel2, "MS Sans Serif", 9, 400,0,21
'----------------------------------------
CONTROL panel2,"E,HPAFFBoxB,75,55,45,20,0x50800000,22"
SETFONT panel2, "MS Sans Serif", 9, 400,0,22
'----------------------------------------
CONTROL panel2,"E,HPAFFBoxC,75,80,45,20,0x50800000,23"
SETFONT panel2, "MS Sans Serif", 9, 400,0,23
'----------------------------------------
LINE panel2,20,110,180,110
'---------------------------------------
CONTROL panel2,"E,NewHPbox,75,120,45,20,0x50800000,24"
SETFONT panel2, "MS Sans Serif", 9, 400,0,24
'---------------------------------------
CONTROL panel2,"T,Enter Old RPM,2,33,70,20,0x5000010B,25"
SETCONTROLCOLOR panel2,25,rgb(0,0,0),RGB(255,255,0)
SETFONT panel2, "MS Sans Serif", 9, 400,0,25
'----------------------------------------
CONTROL panel2,"T,Wanted RPM,8,58,70,20,0x5000010B,26"
SETCONTROLCOLOR panel2,26,rgb(0,0,0),RGB(255,255,0)
SETFONT panel2, "MS Sans Serif", 9, 400,0,26
'----------------------------------------
CONTROL panel2,"T,Enter Old RPM,2,83,70,20,0x5000010B,27"
SETCONTROLCOLOR panel2,27,rgb(0,0,0),RGB(255,255,0)
SETFONT panel2, "MS Sans Serif", 9, 400,0,27
'----------------------------------------
CONTROL panel2,"T,NEW HP =,15,123,70,20,0,28"
SETCONTROLCOLOR panel2,28,0,RGB(255,255,0)
SETFONT panel2, "MS Sans Serif", 9, 400,0,28
'----------------------------------------
listbox2open=1
RETURN


SUB Listbox3

WINDOW panel3,62,5,150,170,@NOCAPTION|@BORDER/4,win,"panel3",main
SETWINDOWCOLOR panel3,RGB(255,255,0)
p=3
'create static & edit controls(ID from 31 to 38)
CONTROL panel3,"E,CBoxA,75,5,45,20,0,31"
SETFONT panel3, "MS Sans Serif", 9, 400,0,31
'----------------------------------------
CONTROL panel3,"E,CBoxB,75,30,45,20,0,32"
SETFONT panel3, "MS Sans Serif", 9, 400,0,32
'----------------------------------------
CONTROL panel3,"E,CboxC,75,55,45,20,0,33"
SETFONT panel3, "MS Sans Serif", 9, 400,0,33
'----------------------------------------
CONTROL panel3,"E,CboxD,75,80,45,20,0,34"
SETFONT panel3, "MS Sans Serif", 9, 400,0,34
'----------------------------------------
LINE panel3,20,110,180,110
'---------------------------------------
CONTROL panel3,"T,Enter GPM,15,8,70,20,0,35"
SETCONTROLCOLOR panel3,35,0,RGB(255,255,0)
SETFONT panel3, "MS Sans Serif", 9, 400,0,35
'----------------------------------------
CONTROL panel3,"T,Enter Feet,15,33,70,20,0,36"
SETCONTROLCOLOR panel3,36,0,RGB(255,255,0)
SETFONT panel3, "MS Sans Serif", 9, 400,0,36
'-----------------------------------
CONTROL panel3,"T,Enter EFF,15,58,70,20,0,37"
SETCONTROLCOLOR panel3,37,0,RGB(255,255,0)
SETFONT panel3, "MS Sans Serif", 9, 400,0,37
'-----------------------------------
CONTROL panel3,"T,Enter HP,15,83,70,20,0,38"
SETCONTROLCOLOR panel3,38,0,RGB(255,255,0)
SETFONT panel3, "MS Sans Serif", 9, 400,0,38
'-----------------------------------
listbox3open=1
RETURN


SUB Listbox4

WINDOW panel4,62,5,150,170,@NOCAPTION|@BORDER/4,win,"panel4",main
SETWINDOWCOLOR panel4,RGB(255,255,0)
p=4
'create static & edit controls(ID from 41 to 48)
CONTROL panel4,"E,HPSclA,75,55,45,20,0x50800000,41"
SETFONT panel4, "MS Sans Serif", 9, 400,0,41
'---------------------------------------
CONTROL panel4,"E,AHPSclB,75,80,45,20,0x50800000,42"
SETFONT panel4, "MS Sans Serif", 9, 400,0,42
'---------------------------------------
LINE panel4,20,110,180,110
'---------------------------------------
CONTROL panel4,"E,Xbox,75,120,45,20,0x50800000,43"
SETFONT panel4, "MS Sans Serif", 9, 400,0,43
'---------------------------------------
CONTROL panel4,"E,Ybox,75,145,45,20,0x50800000,44"
SETFONT panel4, "MS Sans Serif", 9, 400,0,44
'---------------------------------------
CONTROL panel4,"T,Wanted HP,13,58,70,20,0x5000010B,45"
SETCONTROLCOLOR panel4,45,rgb(0,0,0),RGB(255,255,0)
SETFONT panel4, "MS Sans Serif", 9, 400,0,45
'----------------------------------------
CONTROL panel4,"T,HP Now,28,83,70,20,0,46"
SETCONTROLCOLOR panel4,46,rgb(0,0,0),RGB(255,255,0)
SETFONT panel4, "MS Sans Serif", 9, 400,0,46
'----------------------------------------
CONTROL panel4,"T,X = ,52,123,70,20,0,47"
SETCONTROLCOLOR panel4,47,rgb(0,0,0),RGB(255,255,0)
SETFONT panel4, "MS Sans Serif", 9, 400,0,47
'----------------------------------------
CONTROL panel4,"T,Y = ,52,148,70,20,0,48"
SETCONTROLCOLOR panel4,48,rgb(0,0,0),RGB(255,255,0)
SETFONT panel4, "MS Sans Serif", 9, 400,0,48

listbox4open=1
RETURN


SUB Listbox5

WINDOW panel5,62,5,150,170,@NOCAPTION|@BORDER/4,win,"panel5",main
SETWINDOWCOLOR panel5,RGB(255,255,0)
p=5
'create static & edit controls(ID from 51 to 58)
CONTROL panel5,"E,HPSHA,75,30,45,20,0,51"
SETFONT panel5, "MS Sans Serif", 9, 400,0,51
'----------------------------------------
CONTROL panel5,"E,HPSHB,75,55,45,20,0,52"
SETFONT panel5, "MS Sans Serif", 9, 400,0,52
'----------------------------------------
CONTROL panel5,"E,HPSHC,75,80,45,20,0,53"
SETFONT panel5, "MS Sans Serif", 9, 400,0,53
'----------------------------------------
LINE panel5,20,110,180,110
'---------------------------------------
CONTROL panel5,"E,NewHPbox,75,120,45,20,0x50800000,54"
SETFONT panel5, "MS Sans Serif", 9, 400,0,54
'---------------------------------------
CONTROL panel5,"T,RPM New,20,33,70,20,0x5000010B,55"
SETCONTROLCOLOR panel5,55,rgb(0,0,0),RGB(255,255,0)
SETFONT panel5, "MS Sans Serif", 9, 400,0,55
'----------------------------------------
CONTROL panel5,"T,RPM Old,20,58,70,20,0x5000010B,56"
SETCONTROLCOLOR panel5,56,rgb(0,0,0),RGB(255,255,0)
SETFONT panel5, "MS Sans Serif", 9, 400,0,56
'----------------------------------------
CONTROL panel5,"T,NPSH Old,20,83,70,20,0x5000010B,57"
SETCONTROLCOLOR panel5,57,rgb(0,0,0),RGB(255,255,0)
SETFONT panel5, "MS Sans Serif", 9, 400,0,57
'----------------------------------------
CONTROL panel5,"T,New NPSH =,4,123,70,20,0,58"
SETCONTROLCOLOR panel5,58,0,RGB(255,255,0)
SETFONT panel5, "MS Sans Serif", 9, 400,0,58
'----------------------------------------

listbox5open=1
RETURN


SUB Listbox6

WINDOW panel6,62,5,150,170,@NOCAPTION|@BORDER/4,win,"panel4",main
SETWINDOWCOLOR panel6,RGB(255,255,0)
p=6
'create static & edit controls(ID from 61 to 70)

CONTROL panel6,"E,TrimA,75,30,45,20,0x50800000,61"
SETFONT panel6, "MS Sans Serif", 9, 400,0,61
'----------------------------------------
CONTROL panel6,"E,TrimB,75,55,45,20,0x50800000,62"
SETFONT panel6, "MS Sans Serif", 9, 400,0,62
'---------------------------------------
CONTROL panel6,"E,TrimC,75,80,45,20,0x50800000,63"
SETFONT panel6, "MS Sans Serif", 9, 400,0,63
'---------------------------------------
LINE panel6,20,110,180,110
'---------------------------------------
CONTROL panel6,"E,Xbox,75,120,45,20,0x50800000,64"
SETFONT panel6, "MS Sans Serif", 9, 400,0,64
'---------------------------------------
CONTROL panel6,"E,Ybox,75,145,45,20,0x50800000,65"
SETFONT panel6, "MS Sans Serif", 9, 400,0,65
'---------------------------------------
CONTROL panel6,"T,Enter Feet,22,33,70,20,0,66"
SETCONTROLCOLOR panel6,66,0,RGB(255,255,0)
SETFONT panel6, "MS Sans Serif", 9, 400,0,66
'-----------------------------------
CONTROL panel6,"T,Enter New Trim,2,58,70,20,0x5000010B,67"
SETCONTROLCOLOR panel6,67,rgb(0,0,0),RGB(255,255,0)
SETFONT panel6, "MS Sans Serif", 9, 400,0,67
'----------------------------------------
CONTROL panel6,"T,Correction No.,2,83,70,20,0,68"
SETCONTROLCOLOR panel6,68,rgb(0,0,0),RGB(255,255,0)
SETFONT panel6, "MS Sans Serif", 9, 400,0,68
'----------------------------------------
CONTROL panel6,"T,X = ,52,123,70,20,0,69"
SETCONTROLCOLOR panel6,69,rgb(0,0,0),RGB(255,255,0)
SETFONT panel6, "MS Sans Serif", 9, 400,0,69
'----------------------------------------
CONTROL panel6,"T,Y = ,52,148,70,20,0,70"
SETCONTROLCOLOR panel6,70,rgb(0,0,0),RGB(255,255,0)
SETFONT panel6, "MS Sans Serif", 9, 400,0,70

listbox6open=1
RETURN


SUB checkpanel
'check if you wannt more panels
SELECT p
CASE 1
CLOSEWINDOW panel1
CASE 2
CLOSEWINDOW panel2
CASE 3
CLOSEWINDOW panel3
CASE 4
CLOSEWINDOW panel4
CASE 5
CLOSEWINDOW panel5
CASE 6
CLOSEWINDOW panel6
ENDSELECT
RETURN

SUB OpenToolWin
WINDOW tw,200,5,250,250,@minbox|@toolwindow,0,"ToolWindow",tmain
setfocus win

RETURN
waituntil tw=0

sub tmain
if @class=@idclosewindow
closewindow tw
endif
return
Title: Re: Please help me out with this very easy question
Post by: LarryMc on September 09, 2008, 06:08:24 AM
I thought this is what you meant by keep it on top.
declare "user32",SetWindowPos(Hwnd:int,HwndAfter:int,x:int,y:int,cx:int,cy:int,flags:int)
setid "SWP_NOMOVE",2
setid "SWP_NOSIZE",1
setid "HWND_TOPMOST",-1
setid "HWND_NOTOPMOST",-2

'hobo example
DEF win:WINDOW
DEF add2numberopen,add3numberopen:int

WINDOW win,0,0,200,300,@MINBOX,0," CURVE Wiz",Handler
SETWINDOWCOLOR win,RGB(255,255,0)
'Centerwindow win
SetWindowPos(win,@HWND_TOPMOST,0,0,0,0,@SWP_NOMOVE|@SWP_NOSIZE)

'Draw Buttons'
CONTROL win,"B,Add2Num,5,5,60,20,0,1"
SETFONT win, "MS Sans Serif", 9, 400,0,1
CONTROL win,"B,Add3Num,5,30,60,20,0,2"
SETFONT win, "MS Sans Serif", 9, 400,0,2
'add edit fields
CONTROL win,"E,inputX,120,40,70,20,0,3"
showwindow win, @swhide,3
CONTROL win,"E,inputY,120,65,70,20,0,4"
showwindow win, @swhide,4
CONTROL win,"E,inputZ,120,15,70,20,0,9"
showwindow win, @swhide,9
CONTROL win,"E,output,120,115,70,20,0,7"
showwindow win, @swhide,7
CONTROL win,"T,Sum =,75,115,30,20,0,8"
showwindow win, @swhide,8
SETFONT win, "MS Sans Serif", 9, 400,0,8
SETCONTROLCOLOR win,8,0,rgb(255,255,0)
LINE win,100,100,190,100,RGB(255,255,0)

run =  1
WAITUNTIL win=0
END

Handler:
SELECT @CLASS

   CASE @IDCLOSEWINDOW
      CLOSEWINDOW win
   
   CASE @IDCONTROL
IF (@controlid=1)&(add3numberopen=1)
showwindow win, @swhide,9
add3numberopen=0
ENDIF
IF (@controlid=1)&(add2numberopen=0)
'showwindow win, @swhide,9
add2number()
ENDIF
IF (@controlid=2)&(add3numberopen=0)
add3number()
    ENDIF

ENDSELECT
RETURN

SUB add2number
LINE win,100,100,190,100
showwindow win, @swrestore,3
showwindow win, @swrestore,4
showwindow win, @swhide,9
showwindow win, @swrestore,7
showwindow win, @swrestore,8
add2numberopen=1
RETURN

SUB add3number
LINE win,100,100,190,100
showwindow win, @swrestore,3
showwindow win, @swrestore,4
showwindow win, @swrestore,9
showwindow win, @swrestore,7
showwindow win, @swrestore,8
add3numberopen=1
RETURN


Larry
Title: Re: Please help me out with this very easy question
Post by: aurelCB on September 09, 2008, 07:13:16 AM
Another solution might be :
If you drag window with mouse somewhere else on screen,
you can return on top pressing button "T".

declare "user32",SetWindowPos(Hwnd:int,HwndAfter:int,x:int,y:int,cx:int,cy:int,flags:int)
setid "SWP_NOMOVE",2
setid "SWP_NOSIZE",1
setid "HWND_TOPMOST",-1
setid "HWND_NOTOPMOST",-2

'hobo example
DEF win:WINDOW
DEF add2numberopen,add3numberopen:int

WINDOW win,0,0,200,300,@MINBOX,0," CURVE Wiz",Handler
SETWINDOWCOLOR win,RGB(255,255,0)
'Centerwindow win
SetWindowPos(win,@HWND_TOPMOST,0,0,100,0,@SWP_NOMOVE|@SWP_NOSIZE)

'Draw Buttons'
CONTROL win,"B,Add2Num,5,5,60,20,0,1"
SETFONT win, "MS Sans Serif", 9, 400,0,1
CONTROL win,"B,Add3Num,5,30,60,20,0,2"
SETFONT win, "MS Sans Serif", 9, 400,0,2
'add edit fields
CONTROL win,"E,inputX,120,40,70,20,0,3"
showwindow win, @swhide,3
CONTROL win,"E,inputY,120,65,70,20,0,4"
showwindow win, @swhide,4
CONTROL win,"E,inputZ,120,15,70,20,0,9"
showwindow win, @swhide,9
CONTROL win,"E,output,120,115,70,20,0,7"
showwindow win, @swhide,7
CONTROL win,"T,Sum =,75,115,30,20,0,8"
showwindow win, @swhide,8
SETFONT win, "MS Sans Serif", 9, 400,0,8
SETCONTROLCOLOR win,8,0,rgb(255,255,0)
LINE win,100,100,190,100,RGB(255,255,0)

run =  1
WAITUNTIL win=0
END

Handler:
SELECT @CLASS

   CASE @IDCLOSEWINDOW
      CLOSEWINDOW win
   
   CASE @IDCONTROL
IF (@controlid=1)&(add3numberopen=1)
showwindow win, @swhide,9
add3numberopen=0
ENDIF
IF (@controlid=1)&(add2numberopen=0)
'showwindow win, @swhide,9
add2number()
ENDIF
IF (@controlid=2)&(add3numberopen=0)
add3number()
    ENDIF
'set on top of screen
Case @idkeydown
IF (@CODE = ASC("T")|ASC("t"))
OnTop()
ENDIF

ENDSELECT
RETURN

SUB add2number
LINE win,100,100,190,100
showwindow win, @swrestore,3
showwindow win, @swrestore,4
showwindow win, @swhide,9
showwindow win, @swrestore,7
showwindow win, @swrestore,8
add2numberopen=1
RETURN

SUB add3number
LINE win,100,100,190,100
showwindow win, @swrestore,3
showwindow win, @swrestore,4
showwindow win, @swrestore,9
showwindow win, @swrestore,7
showwindow win, @swrestore,8
add3numberopen=1
RETURN

SUB OnTop
SETSIZE win, 0, 0, 200, 300

Return
Title: Re: Please help me out with this very easy question
Post by: Hobo on September 09, 2008, 09:43:08 AM
You guys help me out so much in the past week or so. Thank you very much. I really appreciate it.
I only hope that this thread not only helped me, but will help others, especially beginners.

Thanks,

Hobo
Title: Re: Please help me out with this very easy question
Post by: Hobo on September 09, 2008, 12:27:22 PM
This is cool. I added a checkbox to control the "Stay on Top" 

Only thing I need is to find out how to get user INPUT. I tried to use

text$ = GETCONTROLTEXT (win, ID)

and

SETCONTROLTEXT win, ID, text$

controls, but it seems these commands only deal with strings. Am I right?
I want to work with numbers. I can't find commands like, GETNUMBER or READINPUT and OUTPUT etc.


'hobo example

'-------------------------
'Stay on Top setup
declare "user32",SetWindowPos(Hwnd:int,HwndAfter:int,x:int,y:int,cx:int,cy:int,flags:int)
setid "SWP_NOMOVE",2
setid "SWP_NOSIZE",1
setid "HWND_TOPMOST",-1
setid "HWND_NOTOPMOST",-2
'--------------------------

DEF win:WINDOW
DEF add2numberopen,add3numberopen:int

WINDOW win,0,0,200,300,@MINBOX,0," CURVE Wiz",Handler
SETWINDOWCOLOR win,RGB(255,255,0)
Centerwindow win

'Draw Buttons'
CONTROL win,"B,Add2Num,5,5,60,20,0,1"
SETFONT win, "MS Sans Serif", 9, 400,0,1
CONTROL win,"B,Add3Num,5,30,60,20,0,2"
SETFONT win, "MS Sans Serif", 9, 400,0,2
CONTROL win,"B,Submit,70,200,60,20,0,10"
SETFONT win, "MS Sans Serif", 9, 400,0,10
showwindow win, @swhide,10
'Add edit fields
CONTROL win,"E,inputX,120,40,70,20,0,3"
showwindow win, @swhide,3
CONTROL win,"E,inputY,120,65,70,20,0,4"
showwindow win, @swhide,4
CONTROL win,"E,inputZ,120,15,70,20,0,9"
showwindow win, @swhide,9
CONTROL win,"E,output,120,115,70,20,0,7"
showwindow win, @swhide,7
CONTROL win,"T,Sum =,75,115,30,20,0,8"
showwindow win, @swhide,8
SETFONT win, "MS Sans Serif", 9, 400,0,8
SETCONTROLCOLOR win,8,0,rgb(255,255,0)
LINE win,100,100,190,100,RGB(255,255,0)
'Add Checkbox
CONTROL win,"C,,25,150,20,20,0x50000003,11"
SETCONTROLCOLOR win,11,rgb(0,0,0),RGB(255,255,0)

run =  1
WAITUNTIL win=0
END

Handler:
SELECT @CLASS

   CASE @IDCLOSEWINDOW
      CLOSEWINDOW win
   
   CASE @IDCONTROL
IF (@controlid=1)&(add3numberopen=1)
showwindow win, @swhide,9
add3numberopen=0
ENDIF
IF (@controlid=1)&(add2numberopen=0)
add2number()
ENDIF
IF (@controlid=2)&(add3numberopen=0)
add3number()
    ENDIF
'Stay on top control
IF (@CONTROLID=11)
mark =  GETSTATE (win, 11)
IF mark =1
SetWindowPos(win,@HWND_TOPMOST,0,0,0,0,@SWP_NOMOVE|@SWP_NOSIZE)
ELSE
SetWindowPos(win,@HWND_NOTOPMOST,0,0,0,0,@SWP_NOMOVE|@SWP_NOSIZE)
ENDIF
ENDIF

ENDSELECT
RETURN

SUB add2number
LINE win,100,100,190,100
showwindow win, @swrestore,3
showwindow win, @swrestore,4
showwindow win, @swhide,9
showwindow win, @swrestore,7
showwindow win, @swrestore,8
showwindow win, @swrestore,10
add2numberopen=1
RETURN

SUB add3number
LINE win,100,100,190,100
showwindow win, @swrestore,3
showwindow win, @swrestore,4
showwindow win, @swrestore,9
showwindow win, @swrestore,7
showwindow win, @swrestore,8
showwindow win, @swrestore,10
add3numberopen=1
RETURN
Title: Re: Please help me out with this very easy question
Post by: Hobo on September 09, 2008, 12:39:32 PM
I forgot to add. Moving the window by Pressing â€Ã...“Tâ€Ã, is a neat idea.  Very useful command. Thanks Aurel. 
Title: Re: Please help me out with this very easy question
Post by: aurelCB on September 09, 2008, 01:26:38 PM
Thanks hobo but your example dont work!
I change api function to ordinary SETSIZE and work, try:

'Stay on Top setup
declare "user32",SetWindowPos(Hwnd:int,HwndAfter:int,x:int,y:int,cx:int,cy:int,flags:int)
setid "SWP_NOMOVE",2
setid "SWP_NOSIZE",1
setid "HWND_TOPMOST",-1
setid "HWND_NOTOPMOST",-2
'--------------------------

DEF win:WINDOW
DEF add2numberopen,add3numberopen:int

WINDOW win,0,0,200,300,@MINBOX,0," CURVE Wiz",Handler
SETWINDOWCOLOR win,RGB(255,255,0)
Centerwindow win

'Draw Buttons'
CONTROL win,"B,Add2Num,5,5,60,20,0,1"
SETFONT win, "MS Sans Serif", 9, 400,0,1
CONTROL win,"B,Add3Num,5,30,60,20,0,2"
SETFONT win, "MS Sans Serif", 9, 400,0,2
CONTROL win,"B,Submit,70,200,60,20,0,10"
SETFONT win, "MS Sans Serif", 9, 400,0,10
showwindow win, @swhide,10
'Add edit fields
CONTROL win,"E,inputX,120,40,70,20,0,3"
showwindow win, @swhide,3
CONTROL win,"E,inputY,120,65,70,20,0,4"
showwindow win, @swhide,4
CONTROL win,"E,inputZ,120,15,70,20,0,9"
showwindow win, @swhide,9
CONTROL win,"E,output,120,115,70,20,0,7"
showwindow win, @swhide,7
CONTROL win,"T,Sum =,75,115,30,20,0,8"
showwindow win, @swhide,8
SETFONT win, "MS Sans Serif", 9, 400,0,8
SETCONTROLCOLOR win,8,0,rgb(255,255,0)
LINE win,100,100,190,100,RGB(255,255,0)
'Add Checkbox
CONTROL win,"C,,25,150,20,20,0x50000003,11"
SETCONTROLCOLOR win,11,rgb(0,0,0),RGB(255,255,0)
move win,25,130
print win


run =  1
WAITUNTIL win=0
END

Handler:
SELECT @CLASS

   CASE @IDCLOSEWINDOW
      CLOSEWINDOW win
   
   CASE @IDCONTROL
IF (@controlid=1)&(add3numberopen=1)
showwindow win, @swhide,9
add3numberopen=0
ENDIF
IF (@controlid=1)&(add2numberopen=0)
add2number()
ENDIF
IF (@controlid=2)&(add3numberopen=0)
add3number()
    ENDIF
'Stay on top control
IF (@CONTROLID=11)
mark =  GETSTATE (win, 11)
IF mark =1
SETSIZE win, 0, 0, 200, 300
'SetWindowPos(win,@HWND_TOPMOST,0,0,0,0,@SWP_NOMOVE|@SWP_NOSIZE)
ELSE
SetWindowPos(win,@HWND_NOTOPMOST,0,0,0,0,@SWP_NOMOVE|@SWP_NOSIZE)
ENDIF
ENDIF

ENDSELECT
RETURN

SUB add2number
LINE win,100,100,190,100
showwindow win, @swrestore,3
showwindow win, @swrestore,4
showwindow win, @swhide,9
showwindow win, @swrestore,7
showwindow win, @swrestore,8
showwindow win, @swrestore,10
add2numberopen=1
RETURN

SUB add3number
LINE win,100,100,190,100
showwindow win, @swrestore,3
showwindow win, @swrestore,4
showwindow win, @swrestore,9
showwindow win, @swrestore,7
showwindow win, @swrestore,8
showwindow win, @swrestore,10
add3numberopen=1
RETURN
Title: Re: Please help me out with this very easy question
Post by: Hobo on September 09, 2008, 02:29:27 PM
I see what you try to do. Move the window to the top of the screen.  :)
That is different.

What I tried to do to keep the window top of all the other opened windows. So when you click away the program stays at front. Perhaps I should have said, â€Ã...“Stay front of all other windowsâ€Ã,.   ;)

â€Ã,¦but I learned new command SETSIZE.  :)

Thanks
Title: Re: Please help me out with this very easy question
Post by: aurelCB on September 09, 2008, 03:07:46 PM
Oh my i see now,something like domodal.
That you must use APi like in Larry example(i think )  ;)
Title: Re: Please help me out with this very easy question
Post by: aurelCB on September 09, 2008, 03:20:07 PM
OK i try Larry example and work fine. ;)
Title: Re: Please help me out with this very easy question
Post by: Hobo on September 24, 2008, 03:52:57 PM
This easy question turned into many not so easy questions, but because of your help I was able to complete my program. Thank you all.

This program will be a little aid to my work, whenever I need to do repeating calculations. It is useless most of you, but perhaps one or two might found it interesting or want to change it for better or different use. Therefore, I would like to share it.

The zip file includes a conversion EXE program too. I included because my program calls it up when you press CONV button.

Regars to all

Hobo