Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Confirm Window.tu
Index -> Programming, Turing -> Turing Submissions
Goto page 1, 2  Next
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
the_short1




PostPosted: Thu Sep 02, 2004 4:01 pm   Post subject: Confirm Window.tu

this is mainly usefull to newer programmers... but its also good for lazy pros too...

ok.... isntead of simply asking a user to say yes or no to a questionl (like text based)... or having to write of GUI code again and a again for all the programs u do.


SOLUtION!

while making my Just To Remind Me! program... i wanted to ask the user if they were shure they wanted to clear the database.... . (in a pop up winow)and i wanted to hopefully use it for other programs... so i made it into a unit..


all the code needed to use and call the command are included in the unit file at the top (but commented '%')... simply put that code into ur program to utilize it.. (its like 4 lines)


its very simple.. very basic... but very handy...

making it a unit was the hardest part... (so u can get the results to pass to ur program.... )

basically... u call it like ConfirmWindow.tu.Create (variable) < whereas variable is a boolean variable u created in ur program to store the result of question...(yes or no)


here is a SS

Posted Image, might have been reduced in size. Click Image to view fullscreen.


DOWNLOAD: http://www.members.shaw.ca/rfolz/ConfirmWindow.tu

^ cant upload to compsci cuz its .tu...


post any comments.. questions on how i did it... suggestions ... or w/e...


and enjoy.. feel free to modify. and use it will any programs u wish... bu just keep the credits at the top of the file...
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Thu Sep 02, 2004 4:12 pm   Post subject: (No subject)

nice, though a skinable window would be better Wink

btw - I think I fixed the .tu upload issue, try now
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
the_short1




PostPosted: Thu Sep 02, 2004 6:30 pm   Post subject: (No subject)

meh.. ill try next tiem i make a turing unit,.,, i tend to make a lot of them now that delos taught me..



btw .. ty...


yea u can customize it all u want... GUI.SetColor can be changed to ur liking... background color can be changed.. and so can the are u sure text color... meh.. i was goig nfor really simple.. so new progreamers could find this usefull... specially since schools gona start.. they will be floading in here finding stuff..
beard0




PostPosted: Thu Sep 09, 2004 12:09 pm   Post subject: (No subject)

You shouldn't hide the window at the end, but actually close it. Otherwise, it uses memory (You can reopen it with everything as it was when you closed it by calling Window.Show when you hide it)
the_short1




PostPosted: Thu Sep 09, 2004 3:52 pm   Post subject: (No subject)

cant close it... their was a bug (at least when i had it in my Just To Remind Me! program... ) when i closed it... it had some window error and crap... so me n delta or delos .. forget now.. just decided to hide it... <i asked him if he had any ideas to fixing that bug..
wtd




PostPosted: Thu Sep 09, 2004 11:51 pm   Post subject: (No subject)

Good golly... that looks almost disturbingly like Ada, without the semi-colons, or really powerful type system.

Of course they're both Pascal-derived, so that probably shouldn't be so surprising.
rizzix




PostPosted: Sat Sep 11, 2004 3:39 pm   Post subject: (No subject)

heh not as good though.. infact its a limiting language.

it does not support function overloading
it does not have constructors or destructors
it can display only a limited range of characters *sigh*
it does not have any sort of preprocessor capabilites (although it claims to have.. but i could be wrong.. no-one has figure out how to us it yet)
and there's a lot more it can't do inluding its inability to be extend with native support (c/c++/whtever)
wtd




PostPosted: Sun Sep 12, 2004 1:49 am   Post subject: (No subject)

rizzix wrote:
heh not as good though.. infact its a limiting language.

it does not support function overloading


It does actually somewhat, but functions or procedures that take different arguments should really have different names, since they generally do different things.

Quote:
it does not have constructors or destructors


Nor do many other object-oriented languages. Objective-C, Ruby, Python, Perl, Eiffel, Dylan, etc. all have no magical constructors. They have functions and/or procedures which are called by default to initialize instance variables, but they're called explicitly.

Quote:
it can display only a limited range of characters *sigh*


How so?

Quote:
it does not have any sort of preprocessor capabilites (although it claims to have.. but i could be wrong.. no-one has figure out how to us it yet)


Preprocessors are generally not good. Consider that clean C++ code should never contain anything other than includes and conditional include guards.

Consider that most other languages provide automatic facilities for both of these things... Java, Eiffel. Those languages which require explicit imports of modules make that a part of the language proper, rather than something that gets preprocessed in before the compiler gets to it.

Quote:
and there's a lot more it can't do inluding its inability to be extend with native support (c/c++/whtever)


Ada, if memory serves, has at least a C foreign function interface (FFI), and I believe some commericla implementations can interface to Fortran and Cobol.
Sponsor
Sponsor
Sponsor
sponsor
rizzix




PostPosted: Sun Sep 12, 2004 1:17 pm   Post subject: (No subject)

gosh wtd.. if you dont have function overloading.. writing inherited classes is a real pain -,-

believe me. its not proper oop. and i understand how obj-c has no constructors but i bet there's at least some standard of some sort similar to a destructor at the least. turing has nothing.

about displaying only a limited range of characters.. a lot of folks have been complaining about it *sigh*.. holtsoft dosent give a damn.

we can't extend its capabilites.. that is sad.

and no preprocessors.. well to tell you the truth i hate the idea of a preprocessor only because it complicates things. and its not needed for something so preprietary and controlled. but importing classes etc, is not as flexible and java or c++ and it has nothing that can further classify a group of classes like a namespace or package, this itself gives rise to a lot of problems.

lets say i want to import all classes in package abc in java i would simply write somthing like: import abc.*;
in c++ i would write somthing like: using namespace abc;

turing i can't do that.. that kills!! its really annoying. i need to manually import individually all 100 classes. *sigh*

turing has another keyword called include that is equivalent to the include keyword in c/c++. but it will complain about a file being included more than once. with out preprocessor directives is quite impossible to get around this annoying error.
wtd




PostPosted: Sun Sep 12, 2004 1:20 pm   Post subject: (No subject)

Oh... you were talking about Turing. I was talking about Ada95. Smile
rizzix




PostPosted: Sun Sep 12, 2004 1:24 pm   Post subject: (No subject)

aha well there u go. Laughing
wtd




PostPosted: Sun Sep 12, 2004 1:29 pm   Post subject: (No subject)

rizzix wrote:
gosh wtd.. if you dont have function overloading.. writing inherited classes is a real pain -,-


Not really.

People inherit from classes all the time in Ruby, Eiffel, Objective-C, O'Caml, etc. All of those are just as object-oriented as Java or C++.

rizzix wrote:
believe me. its not proper oop. and i understand how obj-c has no constructors but i bet there's at least some standard of some sort similar to a destructor at the least. turing has nothing.


Standards are good, but factory methods are just as usable as automagical constructors. In fact, I would say they're better, since constructors in languages like Java and C++ (and probably C#, though I can't swear to that) are not actual methods, and can't be invoked in any context other than the initial creation of an object.

In three of the four languages I mentioned above (Ruby, Eiffel, Objective-C), the initialization of an object's instance variables can happen at any time.

rizzix wrote:
turing i can't do that.. that kills!! its really annoying. i need to manually import individually all 100 classes. *sigh*


To be fair, in C++ you'd have to have 100 include statements, if the classes are in individual files, as they should be.

But preprocessors are a horrible idea. They simply allow the old idea that everything is one giant source file to continue, rather than embracing the reality that different bits of the program are in different files. The computer doesn't care, but a programmer debugging a large program with many modules in many files does care.

Our goal, as programmers, is to abstract programming to the point where source isn't being written for the machine, but for other people. Programs should be masterful works of prose. The machine will never care, but other people will.
rizzix




PostPosted: Sun Sep 12, 2004 2:00 pm   Post subject: (No subject)

so lets say:
code:

class A
     proc init()

     end init
end A

class B
     inherit A
     proc init(name : string)

     end init
end B
as u can see above, that is impossible and if you follow below its also rather cumbersome:

wouldn't you rather have
code:
b -> init("def")


than
code:

b -> initWithName("abc")


actually this would be even better (with optional labels)
code:
b -> init(name:"abc")
wtd




PostPosted: Sun Sep 12, 2004 3:35 pm   Post subject: (No subject)

code:
class
   A
creation { ANY } -- public creation procedures
   make
feature { ANY } -- public
   make is
      do
         foo := "yo"
      end
feature { NONE } -- private
   foo : STRING
end

class
   B
inherit
   A
      rename make as default_make
      end
creation { ANY }
   default_make, make
feature { ANY }
   make(name : STRING) is
      do
         foo := name
      end
end
the_short1




PostPosted: Wed Sep 15, 2004 10:30 am   Post subject: (No subject)

when did a turing source code thread become spam about a other programming language??

noramlly i dont care much.. and hey i miet do it myself... but.... jeeze.... 8 posts in a row of spam Sad
Display posts from previous:   
   Index -> Programming, Turing -> Turing Submissions
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 2  [ 17 Posts ]
Goto page 1, 2  Next
Jump to:   


Style:  
Search: