Gamestudio Links
Zorro Links
Newest Posts
loading historical data 1st time
by AndrewAMD. 04/14/23 12:54
Trade at bar open
by juanex. 04/13/23 19:43
Bug in Highpass2 filter
by rki. 04/13/23 09:54
Adding Limit Orders For IB
by scatters. 04/11/23 16:16
FisherN
by rki. 04/11/23 08:38
AUM Magazine
Latest Screens
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Hecknex World
Who's Online Now
3 registered members (AndrewAMD, juanex, Grant), 1,018 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
rki, FranzIII, indonesiae, The_Judge, storrealba
18919 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
can make textbox and listbox ? #243086
12/27/08 20:18
12/27/08 20:18
Joined: May 2008
Posts: 257
D
djfeeler Offline OP
Member
djfeeler  Offline OP
Member
D

Joined: May 2008
Posts: 257
hello,

I wonder if with game studio can make textbox and listbox ? if yes how

Thank you in advance

Last edited by djfeeler; 12/27/08 20:19.
Re: can make textbox and listbox ? [Re: djfeeler] #243088
12/27/08 20:34
12/27/08 20:34
Joined: Jan 2008
Posts: 1,580
Blade280891 Offline
Serious User
Blade280891  Offline
Serious User

Joined: Jan 2008
Posts: 1,580
You are thinking of vb, read through the lite-c tutorials to learn how to print text on screen.

And a list box will require some more advanced knowledge of lite-c

(Unless you want C-Script, then i don't know, but you didn't say)


My Avatar Randomness V2

"Someone get me to the doctor, and someone call the nurse
And someone buy me roses, and someone burned the church"
Re: can make textbox and listbox ? [Re: djfeeler] #243147
12/28/08 11:56
12/28/08 11:56
Joined: May 2008
Posts: 257
D
djfeeler Offline OP
Member
djfeeler  Offline OP
Member
D

Joined: May 2008
Posts: 257
I found the answer for those that are interested must seek win32 api c window in a search engine, there is an example in the software samples for example imageviewver.c

Re: can make textbox and listbox ? [Re: djfeeler] #419102
03/06/13 11:15
03/06/13 11:15

T
tolu619
Unregistered
tolu619
Unregistered
T



So in other words, there's no way to make a textbox in Lite-C?

Re: can make textbox and listbox ? [Re: ] #419103
03/06/13 11:29
03/06/13 11:29
Joined: Jul 2008
Posts: 2,101
Germany
rayp Offline

X
rayp  Offline

X

Joined: Jul 2008
Posts: 2,101
Germany


Acknex umgibt uns...zwischen Dir, mir, dem Stein dort...
"Hey Griswold ... where u gonna put a tree that big ?"
1998 i married my loved wife ... Sheeva from Mortal Kombat, not Evil-Lyn as might have been expected
rayp.flags |= UNTOUCHABLE;
Re: can make textbox and listbox ? [Re: rayp] #419105
03/06/13 11:51
03/06/13 11:51
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Happy Birthday Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Depending on your needs a regular TEXT object with WWRAP and size_x could do the trick, too.


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: can make textbox and listbox ? [Re: ] #419106
03/06/13 11:54
03/06/13 11:54
Joined: Sep 2007
Posts: 101
Luxembourg
K
krial057 Offline
Member
krial057  Offline
Member
K

Joined: Sep 2007
Posts: 101
Luxembourg
Originally Posted By: tolu619
So in other words, there's no way to make a textbox in Lite-C?

It is, but you have to program the textbox yourself. (or use the windows api)
Here is an example of an implementation i did a time ago in Lite-C. You can select, copy, paste, etc. (depends on some other functions i wrote, but you can understand the main idea. If you want I can also post the rest of the code
Click to reveal..
Code:
int UITextGetCharacterIndexAtPos(int xOffset)
{
	int i;
	int sizeofa = str_width("a", UITextCurrentFont);
	for(i = 0; i < str_len(UITextCurrent); i++)
	{
		STRING* temp = str_cut(NULL, UITextCurrent, 0, i+1);
		str_cat(temp, "a");
		int width = str_width(temp, UITextCurrentFont) - sizeofa;
		if(width > xOffset)
		{
			return i+1;
		}
	}
	return str_len(UITextCurrent) + 1;
}

int UITextGetCharacterPos(int index)
{
	//a: fix sizeof space...(probably find a better solution :S)
	if(index <= 1) return 0;
	int sizeofa = str_width("a", UITextCurrentFont);
	STRING* temp = _str("");
	if(index > str_len(UITextCurrent)) 
		str_cpy(temp, UITextCurrent);
	else
		temp = str_cut(NULL, UITextCurrent, 0, index - 1);
	str_cat(temp, "a");
	int width = str_width(temp, UITextCurrentFont) -  sizeofa;
	return width;
}

void UITextSelectionClear()
{
	UITextSelectionStart = UITextCursorPos;
}

void UITextErease(int start, int end)
{
	STRING* temp = _str("");
	if(start > 1)
		str_cut(temp, UITextCurrent, 0, start-1);
	STRING* temp2 = _str("");
	str_cut(temp2, UITextCurrent, end, 0);
	str_cpy(UITextCurrent, temp);
	str_cat(UITextCurrent, temp2);
}

void UITextInsert(int start, STRING* insertChar)
{
	STRING* temp = _str("");
	if(start > 1)
		str_cut(temp, UITextCurrent, 0, start-1);
	STRING* temp2 = _str("");
	str_cut(temp2, UITextCurrent, start, 0);
	str_cpy(UITextCurrent, temp);
	str_cat(UITextCurrent, insertChar);
	str_cat(UITextCurrent, temp2);
}

BOOL UITextSelectionErease()
{
	if(UITextSelectionStart == UITextCursorPos) return false;
	var start = minv(UITextSelectionStart, UITextCursorPos);
	var end = maxv(UITextSelectionStart, UITextCursorPos);
	UITextErease(start, end);
	UITextSelectionStart = UITextCursorPos = start;
	return true;
}

STRING* UITextSelectionGet()
{
	var start = minv(UITextSelectionStart, UITextCursorPos);
	var end = maxv(UITextSelectionStart, UITextCursorPos);
	STRING* temp = _str("");
	str_cut(temp, UITextCurrent, start, end);
	return temp;
}
void UITextEditableRender(UIRect contentarea, int height, BOOL inRect)
{
	if(inRect && IPGetKeyDown("Mouse left"))
	{
		UITextCursorPos = UITextGetCharacterIndexAtPos(IPMousePosition.x - contentarea->x);
		if(!IPGetKey("shiftl") && !IPGetKey("shiftr"))
			UITextSelectionClear();
	}
	if(inRect && IPGetKey("Mouse left"))
	{
		UITextCursorPos = UITextGetCharacterIndexAtPos(IPMousePosition.x - contentarea->x);
	}
	if(IPGetKeyDown("cul"))
	{
		UITextCursorPos = maxv(--UITextCursorPos, 1);
		if(!IPGetKey("shiftl") && !IPGetKey("shiftr"))
			UITextSelectionClear();
	}
	else if(IPGetKeyDown("cur"))
	{
		UITextCursorPos = minv(++UITextCursorPos, str_len(UITextCurrent)+1);
		if(!IPGetKey("shiftl") && !IPGetKey("shiftr"))
			UITextSelectionClear();
	}
	else if(IPGetKeyDown("home"))
	{
		if(!IPGetKey("shiftl") && !IPGetKey("shiftr"))
		{
			UITextCursorPos = 1;
			UITextSelectionClear();
		}
		else
		{
			UITextSelectionStart = UITextCursorPos;
			UITextCursorPos = 1;
		}
	}
	else if(IPGetKeyDown("end"))
	{
		if(!IPGetKey("shiftl") && !IPGetKey("shiftr"))
		{
			UITextCursorPos = str_len(UITextCurrent)+1;
			UITextSelectionClear();
		}
		else
		{
			UITextSelectionStart = UITextCursorPos;
			UITextCursorPos = str_len(UITextCurrent)+1;
		}
	}
	else if(IPGetKeyDown("bksp") || IPGetKeyDown("del"))
	{
		if(!UITextSelectionErease())
		{
			if(IPGetKeyDown("bksp") && str_len(UITextCurrent)>0 && UITextCursorPos>=1)
				UITextErease(--UITextCursorPos, UITextCursorPos+1);

			if(IPGetKeyDown("del") && str_len(UITextCurrent)>0 && UITextCursorPos <= str_len(UITextCurrent))
				UITextErease(UITextCursorPos, UITextCursorPos+1);
			UITextSelectionClear();
		}
	}
	else if(IPGetKey("ctrl") && IPGetKeyDown("a"))
	{
		UITextCursorPos = 1;
		UITextSelectionStart = str_len(UITextCurrent)+1;
	}
	else if(IPGetKey("ctrl") && (IPGetKeyDown("c") || IPGetKeyDown("x")))
	{
		if(OpenClipboard(hWnd))
		{
			EmptyClipboard();
			long hClipboardData;
			STRING* sel = UITextSelectionGet();
			hClipboardData = GlobalAlloc(GMEM_DDESHARE, str_len(sel)+1);
			char* pchData;
			pchData = (char*)GlobalLock(hClipboardData);
			strcpy(pchData, _chr(sel));
			GlobalUnlock(hClipboardData);
			SetClipboardData(CF_TEXT,hClipboardData);
			CloseClipboard();
			if(IPGetKeyDown("x"))
				UITextSelectionErease();
		}
	}
	else if(IPGetKey("ctrl") && IPGetKeyDown("v"))
	{
		if(OpenClipboard(hWnd))
		{
			UITextSelectionErease();
			HANDLE hClipboardData = GetClipboardData(CF_TEXT);
			char *pchData = (char*)GlobalLock(hClipboardData);
			UITextInsert(UITextCursorPos, pchData);
			UITextCursorPos += str_len(pchData);
			UITextSelectionClear();
			GlobalUnlock(hClipboardData);
			CloseClipboard();
		}
	}
	else if(IPLastCharAscii && str_getchr(IPLastChar, 1) != ' ' && IPLastCharAscii!=0 && IPLastCharAscii > 27 || IPLastCharAscii == 32)
	{
		//printf("%i", (int)IPLastCharAscii);
		UITextSelectionErease();
		UITextInsert(UITextCursorPos, IPLastChar);
		UITextCursorPos++;
		UITextSelectionClear();
	}
	int curPos = UITextGetCharacterPos(UITextCursorPos);
	int startPos = UITextGetCharacterPos(UITextSelectionStart);
	//Draw cursor
	draw_quad(NULL, vector(contentarea->x + curPos, contentarea->y, 0), NULL, vector(1, height, 0), NULL, COLOR_WHITE, 100, 0);
	//Draw selection
	draw_quad(NULL, vector(contentarea->x + curPos, contentarea->y, 0), NULL, vector(startPos - curPos, height, 0), NULL, COLOR_WHITE, 40, 0);
}


Re: can make textbox and listbox ? [Re: krial057] #419115
03/06/13 13:58
03/06/13 13:58
Joined: Oct 2011
Posts: 1,082
Germany
C
Ch40zzC0d3r Offline
Serious User
Ch40zzC0d3r  Offline
Serious User
C

Joined: Oct 2011
Posts: 1,082
Germany
I will release my GWEN convertion soon, be patient, I will also add some kind of anti-cheat which is really effective since Im into gamehacking scene grin


Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1