1. And I thought it would be easy ?? Dos program to a windows program ??
- Posted by Selgor Jan 16, 2011
- 1828 views
Hello
Selgor here
Yes I am requesting help with the following
Old Dos program ...
include swfuncs.e include get.e object a,b,r,w r = 1 a = prompt_number(" Type num ",{}) b = prompt_number(" Type num ",{}) clear_screen() while r > 0 do r = a - b* floor(a/b) if r = 0 then exit end if a = b b = r end while puts(1,"The Greatest Common Denominator is ") ? b w=wait_key()
and this is my feeble attempt
include win32lib.ew without warning constant Win = create( Window, "Win", 0, 200, 100, 640,520, 0 ) include swfuncs.e include get.e object a,b,r,w procedure start_it(integer id, integer event, sequence parms) wPuts( {Win, 10, 10}, "Input a number") wPuts({Win,10,50},"Input second number ") r=1 a = prompt_number(" Type num ",{}) b = prompt_number(" Type num ",{}) -- clear_screen() while r > 0 do r = a - b* floor(a/b) if r = 0 then exit end if a = b b = r end while ? b w= wait_key() end procedure setHandler(Win, w32HActivate, routine_id("start_it")) WinMain( Win, Normal)
I cannot find an example for prompt_number in win32
The above draws a window
Then all else is dos32
In other words it does not work
How can I get a handle on this conversion stuff ??
Or do I just say ... "stuff it" .. which I do not want to do
I have lots more to convert
Any help appreciated
Cheers
Selgor
2. Re: And I thought it would be easy ?? Dos program to a windows program ??
- Posted by petelomax Jan 16, 2011
- 1711 views
Without doing it for you, here is roughly what you need:
include swfuncs.e include get.e
remove those
wPuts( {Win, 10, 10}, "Input a number") wPuts({Win,10,50},"Input second number ")
remove those and create two labels instead
a = prompt_number(" Type num ",{}) b = prompt_number(" Type num ",{})
remove those and create two input fields instead
? b w= wait_key()
remove those and create an output field instead
setHandler(Win, w32HActivate, routine_id("start_it"))
Add an "OK" or "Calculate it" button and use w32HClick on that instead.
You final program should have 7 create() statements
HTH, Pete
3. Re: And I thought it would be easy ?? Dos program to a windows program ??
- Posted by Selgor Jan 16, 2011
- 1728 views
Thanks Pete
for answering my request for help
But, I have no idea what you are writing about.
I think you are telling me to get rid of all my code ??
And I know you are trying to help
But more specific NOT cryptic
Sorry for my ignorance
Cheers
Selgor
4. Re: And I thought it would be easy ?? Dos program to a windows program ??
- Posted by jimcbrown (admin) Jan 16, 2011
- 1706 views
Hello
Selgor here
Yes I am requesting help with the following
Old Dos program ...
include swfuncs.e include get.e object a,b,r,w r = 1 a = prompt_number(" Type num ",{}) b = prompt_number(" Type num ",{}) clear_screen() while r > 0 do r = a - b* floor(a/b) if r = 0 then exit end if a = b b = r end while puts(1,"The Greatest Common Denominator is ") ? b w=wait_key()
and this is my feeble attempt
<snip>
I cannot find an example for prompt_number in win32
The above draws a window
Then all else is dos32
In other words it does not work
How can I get a handle on this conversion stuff ??
Or do I just say ... "stuff it" .. which I do not want to do
I have lots more to convert
Any help appreciated
Cheers
Selgor
Actually, this code is not DOS32 specific. It should work on Linux/GNU and BSD and even on Windows using console mode (eui.exe) . There is no need to "convert" anything. (You may want to change get.e to std/get.e for 4.0 but this is optional.)
5. Re: And I thought it would be easy ?? Dos program to a windows program ??
- Posted by Selgor Jan 16, 2011
- 1700 views
Jim
My programme works as an .ex without a problem.
I wrote it in 2004 to learn euphoria with about 50 odd other programmes
Now, I am trying to write it as a .exw programme.
Yes, I am still using 3.1 Euphoria.
Not up to 4.0 yet
Thanks for your interest ..... appreciated.
Cheers
Selgor
6. Re: And I thought it would be easy ?? Dos program to a windows program ??
- Posted by petelomax Jan 16, 2011
- 1714 views
I have no idea what you are writing about.
more specific NOT cryptic
Are there any parts of my post you /DO/ understand?
Can you tell me /exactly/ where you got "include win32lib.ew" from?
I think you are telling me to get rid of all my code ??
There are five things that need to be replaced.
7. Re: And I thought it would be easy ?? Dos program to a windows program ??
- Posted by kinz Jan 16, 2011
- 1685 views
Hello
Selgor here
Yes I am requesting help with the following
Old Dos program ...
See please one possible solution:
include dos_rescue.ew --- from the Insolor's package --- http://www.rapideuphoria.com/dosrescue2.zip include swfuncs.e include get.e object a,b,r,w r = 1 a = prompt_number(" Type num ",{}) b = prompt_number(" Type num ",{}) clear_screen() while r > 0 do r = a - b* floor(a/b) if r = 0 then exit end if a = b b = r end while puts(1,"The Greatest Common Denominator is ") ? b b = getc(0) --- press Enter instead of wait_key()
Works for me with eui.exe of 4.0. But Rob's dos_rescue.ew of lw doesn't force it to work with exw.exe of 3.1.1, sorry.
And it runs ok with exw.exe of 3.1.1 without includeing of dos_rescue.ew at all.
kinz
8. Re: And I thought it would be easy ?? Dos program to a windows program ??
- Posted by Selgor Jan 16, 2011
- 1694 views
Pete
I always put
include win32lib.ew
without warning
at the start of an .exw programme
I do not know what I am supposed to create 7 times
And a label ... don't know
This .exw programming is not clear to me yet
Cheers
Selgor
9. Re: And I thought it would be easy ?? Dos program to a windows program ??
- Posted by Selgor Jan 17, 2011
- 1629 views
Kinz
My original pogramme works fine
I am trying to write it as a .exw programme
using win32lib
Thanks for your post
Cheers
Selgor
10. Re: And I thought it would be easy ?? Dos program to a windows program ??
- Posted by dcole Jan 17, 2011
- 1614 views
Hello Selgor,
I just made this up on the fly. It should do what you want.
-- code generated by Win32Lib IDE v0.22.0 Build Dec-16-2006 constant TheProgramType="exw" include Win32Lib.ew without warning -------------------------------------------------------------------------------- -- Window Window1 global constant Window1 = createEx( Window, "Window1", 0, Default, Default, 400, 300, 0, 0 ) global constant LText4 = createEx( LText, "Type Number 1 and Enter", Window1, 72, 68, 132, 20, 0, 0 ) global constant EditText2 = createEx( EditText, "", Window1, 208, 68, 48, 20, 0, 0 ) global constant LText5 = createEx( LText, "Type Number 2 and Enter", Window1, 72, 100, 132, 20, 0, 0 ) global constant EditText3 = createEx( EditText, "", Window1, 208, 100, 48, 20, 0, 0 ) global constant LText7 = createEx( LText, "The Greatest Common Denominator is", Window1, 8, 168, 192, 20, 0, 0 ) global constant EditText6 = createEx( EditText, "", Window1, 208, 168, 48, 20, 0, 0 ) global constant LText9 = createEx( LText, "Hit Enter to Restart", Window1, 272, 168, 100, 20, 0, 0 ) --------------------------------------------------------- procedure calculate() integer a,b,r r=1 a=getNumber(EditText2) b=getNumber(EditText3) if a=0 or b=0 then return end if while r > 0 do r = a - b* floor(a/b) if r = 0 then exit end if a = b b = r end while setText(EditText6,b) end procedure -------------------------------------------------------------------------------- procedure Window1_onActivate (integer self, integer event, sequence params)--params is () setVisible(LText9,0) setFocus(EditText2) end procedure setHandler( Window1, w32HActivate, routine_id("Window1_onActivate")) -------------------------------------------------------------------------------- procedure EditText2_onKeyDown (integer self, integer event, sequence params)--params is ( atom scanCode, atom shift ) if params[1]=13 then if self=EditText2 then setText(EditText3,"") doEvents(0) setFocus(EditText3) elsif self=EditText3 then calculate() setVisible(LText9,1) elsif self=EditText6 then setText(EditText2,"") setText(EditText3,"") setText(EditText6,"") setVisible(LText9,0) end if end if end procedure setHandler( {EditText2,EditText3,EditText6}, w32HKeyDown, routine_id("EditText2_onKeyDown")) WinMain( Window1,Normal )
Don Cole
11. Re: And I thought it would be easy ?? Dos program to a windows program ??
- Posted by petelomax Jan 17, 2011
- 1584 views
Pete
I always put
include win32lib.ew
without warning
at the start of an .exw programme
Can you tell me /exactly/ where you got "include win32lib.ew" from?
You found it somewhere. Nevermind, instead read
win32lib_0_70_20\Docs\W32Faq.htm
12. Re: And I thought it would be easy ?? Dos program to a windows program ??
- Posted by Selgor Jan 17, 2011
- 1543 views
Don
It works like a charm
Thank you so much
I wish to choose some words for you
so I will leave this post as is for now
BUT........... please read tomorrow
You are ... and always have been ...
So helpful
Cheers
........................ more to come
Selgor
13. Re: And I thought it would be easy ?? Dos program to a windows program ??
- Posted by Selgor Jan 17, 2011
- 1492 views
Pete
No ........
I just did not read it somewhere If you want to use win32lib then the include must be there
Or that is what I understand
having read many codes
I am O.K. with dos32 or dos etc
It is the win32 stuff that I cannot find specific examples for
I did not post my attempts at message boxes ... and lots of other stuff
Just graduated to .exw programmes and find them difficult..
At 70 years young I am trying to get all my .ex programmes
up to speed .... the "windows" stuff
And I have about 60 odd programmes to go
Bear with me ??
But I will keep going
Cheers
Selgor
14. Re: And I thought it would be easy ?? Dos program to a windows program ??
- Posted by DanM Jan 17, 2011
- 1520 views
Pete
No ........
I just did not read it somewhere If you want to use win32lib then the include must be there
Or that is what I understand
having read many codes
I am O.K. with dos32 or dos etc
It is the win32 stuff that I cannot find specific examples for
I did not post my attempts at message boxes ... and lots of other stuff
Just graduated to .exw programmes and find them difficult..
At 70 years young I am trying to get all my .ex programmes
up to speed .... the "windows" stuff
And I have about 60 odd programmes to go
Bear with me ??
But I will keep going
Cheers
Selgor
Selgor,
Did you notice that Don Cole's Window's version of your program was developed using the IDE? It would probably be a better starting point for making Windows versions of your programs than trying to hand code them.
You do still have to "think differently" to make Windows programs, but using the IDE should make things quite a bit easier.
Just a suggestion.
Dan M.
15. Re: And I thought it would be easy ?? Dos program to a windows program ??
- Posted by Selgor Jan 17, 2011
- 1523 views
Dan
Thank you for the suggestion
Never really used it
But now under advice
I will add it to my learning curve
BTW ...... Dan
You also have been a tower of strength over many years
as has been Don
Both of you seem to crop up at the exact , precise moment..
Thank you so much
Cheers
Selgor
16. Re: And I thought it would be easy ?? Dos program to a windows program ??
- Posted by Insolor Jan 18, 2011
- 1467 views
Hello
Selgor here
Yes I am requesting help with the following
Old Dos program ...
See please one possible solution:
include dos_rescue.ew --- from the Insolor's package --- http://www.rapideuphoria.com/dosrescue2.zip include swfuncs.e include get.e object a,b,r,w r = 1 a = prompt_number(" Type num ",{}) b = prompt_number(" Type num ",{}) clear_screen() while r > 0 do r = a - b* floor(a/b) if r = 0 then exit end if a = b b = r end while puts(1,"The Greatest Common Denominator is ") ? b b = getc(0) --- press Enter instead of wait_key()
Works for me with eui.exe of 4.0. But Rob's dos_rescue.ew of lw doesn't force it to work with exw.exe of 3.1.1, sorry.
And it runs ok with exw.exe of 3.1.1 without includeing of dos_rescue.ew at all.
kinz
The correct solution is:
include dos_rescue.ew as dos_rescue --- from the Insolor's package --- http://www.rapideuphoria.com/dosrescue2.zip include get.e if dos_rescue:graphics_mode(18) then -- create GUI window, actually end if object a,b,r,w r = 1 -- a = prompt_number(" Type num ",{}) dos_rescue:puts(1," Type num ") a = value(dos_rescue:gets(0)) a = a[2] dos_rescue:puts(1,'\n') -- b = prompt_number(" Type num ",{}) dos_rescue:puts(1," Type num ") b = value(dos_rescue:gets(0)) b = b[2] dos_rescue:puts(1,'\n') dos_rescue:clear_screen() while r > 0 do r = a - b* floor(a/b) if r = 0 then exit end if a = b b = r end while dos_rescue:puts(1,"The Greatest Common Denominator is ") -- ? b dos_rescue:printf(1,"%d",b) w=dos_rescue:wait_key()
It works fine with exw.exe and euiw.exe both.
17. Re: And I thought it would be easy ?? Dos program to a windows program ??
- Posted by Selgor Jan 18, 2011
- 1474 views
Insolor
Thank you for posting
Yes programme works well
I did not know that it existed
But now I do
So with Don's, Kinz's and now Insolor's programmes
(And a bit of my rubbish)
I can get all my dos stuff up to speed
Much appreciated
Cheers
Selgor