Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Feature Requests
 Code template idea?
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

rboarman
New Member

2 Posts

Posted - Jul 24 2004 :  2:14:03 PM  Show Profile
Is there a place where people are or should post code templates?

It seems like it would be useful for people to be able to post and swap code templates. IG??d like to see how other people are using this great feature.

Rick

WannabeeDeveloper
Tomato Guru

Germany
775 Posts

Posted - Jul 24 2004 :  3:48:29 PM  Show Profile
You could do it here in the forum using the [ code][ /code]-Tags (or the Button with the "#" over your Edit-Field to enter the Message).

Go to Top of Page

rboarman
New Member

2 Posts

Posted - Jul 24 2004 :  4:13:25 PM  Show Profile
I would love to except that I haven't come up with any good ones yet! I'm still a newb...

Rick
Go to Top of Page

Darren
Tomato Guru

USA
105 Posts

Posted - Jul 25 2004 :  5:35:28 PM  Show Profile
Perhaps we should start a code template forum. My favorite is one for C++ is

//:
// -? [%MONTH%/%DAY%/%YEAR% %HOUR%:%MINUTE%:%SECOND%]
Go to Top of Page

WannabeeDeveloper
Tomato Guru

Germany
775 Posts

Posted - Jul 26 2004 :  06:49:49 AM  Show Profile
Writing own Code-Templates is pretty easy.
I have several Templates (for example: Dialog Procedure using Selection as Function-Name) etc.

DialogProc using selection:
BOOL CALLBACK %0 (HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
	switch(message)
	{		
	case WM_INITDIALOG:
		-?
		return (TRUE);
		
	case WM_DESTROY:
	case WM_CLOSE:
		EndDialog(hDlg,0);
		return (TRUE);
		
	case WM_COMMAND:
		switch (LOWORD(wParam))
		{
		case IDCANCEL:
			EndDialog(hDlg,0);
			return (TRUE);
			
		case IDOK:			
			return (TRUE);
			
		default:
			break;
		}
		return (FALSE);
	}	
	return (FALSE);
}

I'm lazy, you know...

switch using selection:
switch(%0) 
{
case -?:
	break;
default:
	break;
}

Here's my "Semi-intelligent for-statement".
Did this to explore the possibilities with VAX's parser in AutoText-Templates.

Semi-intelligent for-statement:
for (%1 %2 = %3; %2 < %4; %2%5)
{
    -?
}

Opens up a Dialog, asking for:
%1 : Type (e.g. int, UINT, you may leave it blank if you're using an already declared variable)
%2 : Variable (e.g. iIndex)
%3 : initial value of %2 (0 or whatever value you want to start with)
%4 : Maximum value to count to
%5 : Operation to be done (e.g. ++, -- or +=10, whatever)

You can let VAX do almost EVERYTHING for you by simply using Code-Templates.
The -? determins the caret-position after inserting the code...

%0 is the placeholder for your selection
%1 - %x will be asked by a Dialog-Window.
BTW, WTS: It would be cool if we could add Names for these Dialog-Windows.
Right now, when there's a %1, the Dialog-Window also asks for %1.
I'd like to do this:

for ( %1{Type of Variable} %2{Name of Variable} = %3{Initial Value of %2};...

You get the idea...
Is that possible? Enhancing the "Ask the User for %1-%x Values using given names from Template"...


Edited by - WannabeeDeveloper on Jul 26 2004 07:00:32 AM
Go to Top of Page

Darren
Tomato Guru

USA
105 Posts

Posted - Jul 26 2004 :  08:14:56 AM  Show Profile
A good reference article.
AutoText http://www.wholetomato.com/products/features/autotext.html?more=yes
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19014 Posts

Posted - Jul 26 2004 :  08:21:14 AM  Show Profile
WannabeeDeveloper's "intelligent" if is dam impressive

i have previously read the web page on autotext, plus:
http://66.150.196.105/products/features/templates.html?more=yes

but i had never quite put it together in my own head, not the way this example did

zen is the art of being at one with the two'ness
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000