May 18, 2024, 10:27:42 PM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


Please help me out with this very easy question

Started by Hobo, August 21, 2008, 09:44:24 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Hobo

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

Hobo

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

aurelCB

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?

Hobo

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

aurelCB

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

LarryMc

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
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

aurelCB

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

Hobo

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

Hobo

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

Hobo

I forgot to add. Moving the window by Pressing â€Ã...“Tâ€Ã, is a neat idea.  Very useful command. Thanks Aurel. 

aurelCB

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

Hobo

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

aurelCB

Oh my i see now,something like domodal.
That you must use APi like in Larry example(i think )  ;)

aurelCB


Hobo

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