Draging a panel?

Posted By: gfxExp

Draging a panel? - 10/18/09 18:49

Hi,

I experimented a bit with no results. How do I drag a panel with mouse?
Posted By: MichaelGale

Re: Draging a panel? - 10/18/09 22:02

By using the most recent version of A7 wink
Posted By: Widi

Re: Draging a panel? - 10/18/09 22:15

very easy with the newest version... grin
Posted By: gfxExp

Re: Draging a panel? - 10/19/09 04:55

Ok understood, but when someone asks how to draw a cat - the answer is definitely not "use a latest and sharpest pencil...." my question still persists. laugh

How do I make it so that I can drag PANEL* some_pan. I can move it's pos_x and pos_y with mouse_force.x and mouse_force.y - but it doesn't work as expected. And since I can't seem to use events on panel I can't make sure how to execute it when clicked and dragged within the panel.

I tried using a button to detect mouse click within the panel. But the panel isn't moving as intended like you would drag around a windows window.

Ok I'll rephrase the question, how do I make it so that I can drag a panel in the latest version?
Posted By: GorNaKosh

Re: Draging a panel? - 10/19/09 05:28

To detect a mouseclick you can use the event property of a panel. Then you have to start a while-loop assuming the mouseposition to the panel...
Code:
void dragPanel(PANEL *clickedPan) {
   while(mouse_left == 1) {   //dragging the panel while holding the mousebutton
      clickedPan.pos_x = mouse_pos.x
      clickedPan.pos_y = mouse_pos.y
      wait(1);
   }
}

PANEL *some_pan = {
   pos_x = 0;
   pos_y = 0;
   bmap = XYZ;
   flags = SHOW;
   event = dragPanel;
}



Hope it helps wink
Gor Na Kosh
Posted By: gfxExp

Re: Draging a panel? - 10/19/09 08:21

ah, so I don't have to use emask etc. on panel to set an event. Thanks I'll give it a try. laugh

edit
----

I tried and it works, but how would I make it so that the the mouse is in the clicked part of the panel? right now the panel moves exactly at mouse_pos.

Practically like dragging a window, the window doesn't snap to mouse position in windows os etc.

Anyway thank you very much for the help so far. laugh
Posted By: Widi

Re: Draging a panel? - 10/19/09 09:14

@GorNaKosh: don`t support Warez Kiddie !!!!!
Posted By: gfxExp

Re: Draging a panel? - 10/19/09 09:20

Warez as in illegal software? I don't understand why I have Warez Kiddie title while I use a trial version. Does anyone know why? I thought it meant something else but it does mean "that" warez afterall.

Is using trail version illegal now?

Originally Posted By: Widi
@GorNaKosh: don`t support Warez Kiddie !!!!!

Posted By: Widi

Re: Draging a panel? - 10/19/09 18:46

You have the trial? But i think the trial is valid for 30 days and you have registred at 29.8.2009 --> 51 Days!!!!
Posted By: gfxExp

Re: Draging a panel? - 10/19/09 19:02

At first I was honestly using an old trail that i got from someone before (there was no cracks or anything with it, just an installation file saving me time downloading), and then when someone here said it was a beta trail version and that I needed the latest version to continue learning. So I uninstalled it and installed the latest version from the official website itself.

Regardless, I'm using Lite C now. Honestly, why do I even need to explain myself? Just because a moderator wanted me to label me a warez kiddie even after knowing I was using a trail version?

Is this how potential customers are driven away? If i cant learn this, nor get any proper help learning it.. then there is no way I would want to buy it. Maybe I should reconsider switching to C4 engine... it is much more value for the money as well. Not that I can't afford a7.
Posted By: Quad

Re: Draging a panel? - 10/19/09 19:05

first of all, you shown evidence of warez versions on another thread.
second it's good that you switched to lite-c free, ask a moderator to replace your tilte or create a new account.(you know, with that title you wont get much help.)
Posted By: MichaelGale

Re: Draging a panel? - 10/19/09 20:09

I would offer my help. However, normally we ban everyone who uses warez. I don't know why you weren't banned. Anyway, I cannot remove that title unless you show proof that you own a legal version of gamestudio.

Also, I would like to point out that moderators are in no way related to Conitec/opGroup. You can send jcl a PM at any time, though.
Posted By: gfxExp

Re: Draging a panel? - 10/20/09 03:42

Michael,

I repeat myself:

------------------------------------------

At first I was honestly using an old trail that i got from someone before (there was no cracks or anything with it, just an installation file saving me time downloading), and then when someone here said it was a beta trail version and that I needed the latest version to continue learning. So I uninstalled it and installed the latest version from the official website itself.

Regardless, I'm using Lite C now.

------------------------------------------

I've already messaged an mod and they have forwarded it to the admin.
Posted By: gfxExp

Re: Draging a panel? - 10/20/09 03:50

Okay. Please let me know the thread with the evidence if you get the time, it can't exist as I know what I did best... using an illegal software is not what I did and not something I do.

If anything wrong I did... its installing the old trial version without realizing it was not the latest one. I did uninstall that and install the newest one from the official website as soon as I learned that.

Originally Posted By: Quadraxas
first of all, you shown evidence of warez versions on another thread.
second it's good that you switched to lite-c free, ask a moderator to replace your tilte or create a new account.(you know, with that title you wont get much help.)


EDIT
----

Ahh is this the evidence? http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Main=35415&Number=289245 as on the thread, yes I was not aware of the new title as I have no reason to be, having done nothing illegal than dedicate time to learning something which I thought was worthwhile.

How sadly I was mistaken though, it was simply a waste of time maybe?

This is where I downloaded the latest version: http://server.conitec.net/down/gstudio_setup.exe
Posted By: Quad

Re: Draging a panel? - 10/20/09 06:26

you said 7.04 pro, there is no way to get that version unless you are a PRO version owner, it never released to public. Even if you are telling the truth it was your fault to get the 7.04 which is older than 2 years, 55mb is not that large download would only take couple of minutes. Anyway as i said, it's good that you are switched to lite-c free, hope mods replace your title.(plus if you ever installed 7.04, reformat your pc it screws up registry and other versions dont work properly.)
Posted By: gfxExp

Re: Draging a panel? - 10/20/09 07:30

Originally Posted By: Quadraxas
you said 7.04 pro, there is no way to get that version unless you are a PRO version owner, it never released to public. Even if you are telling the truth it was your fault to get the 7.04 which is older than 2 years, 55mb is not that large download would only take couple of minutes. Anyway as i said, it's good that you are switched to lite-c free, hope mods replace your title.(plus if you ever installed 7.04, reformat your pc it screws up registry and other versions dont work properly.)


Ok it was my fault, but being new to this software, how was I to know it was two years old? It was given to me by a friend sometime ago and it was lying around my in backups - she said before that it was a trial of the pro version and that it was a great 3d engine and I should try it. Maybe she was a beta tester.

Anyway, back then I decided stick with 2d engines such as Game Maker by Mark Overmars (currently acquired by YoYoGames I think). Recently when I decided to switch to 3d engines, I dug up the old backups and installed the pro trial at least I thought it was a "pro" version trial.

At first I thought of downloading the latest version from the site, but when I came to the site it showed that "A7" was the latest version. I didn't bother much about 7.x (x part of the program). If it was 2 years old, then shouldn't the latest version be called something like A8 or A9? you can't blame me for thinking there were no newer versions from seeing the "Version A7" on top of 3d game studio homepage.

And my connection speed is 256kbps (I get around 10 to 15 kb/sec most of the time), so downloading is a big deal. Not everyone has 8mbps T1 line.
Posted By: vasco

Re: Draging a panel? - 10/20/09 10:15

hi all

I am unable to add the sliders and the buttons to the panel.. I tried it by "ADD PLUGIN" in the script editor as well as writing codes for the panel editor function... No results.. wat to be done ??
Posted By: gfxExp

Re: Draging a panel? - 10/20/09 10:42

Originally Posted By: vasco
hi all

I am unable to add the sliders and the buttons to the panel.. I tried it by "ADD PLUGIN" in the script editor as well as writing codes for the panel editor function... No results.. wat to be done ??


That's not related to this thread, but I'll help out anyway.

It's better to define panel on your own than using the panelEdit plugin. I would do the following.

Code:
PANEL* some_pan = 
{
	bmap = "panel.tga"; // panel background
 	pos_x = 10; // horizontal margin from screen top left  
 	pos_y = 10; // vertical margin from screen top left

	hslider (x, y, width, "knob.tga", min, max, variable); // here x and y are the horizontal and vertical margin from panel top left

 	button (x, y, "clicked.tga", "normal.tga", "mouse_over.tga", Click_function, normal_function, mouse_over_function); // x and y same as slider, and "normal" function can be used for "on mouse out" functions. Functions can be left as NULL if you don't want to use any.
	
	flags = VISIBLE;
}



Hope it helps, and if it isn't what you asked and if I insulted you in anyway - I apologize in advance. laugh
Posted By: gfxExp

Re: Draging a panel? - 10/20/09 18:20

Anyway, now that the title issue is sorted out. Could anyone push me in the right direction? I'll rephrase my updated doubt.

With GorNaKosh's suggestion - now the panel drags with the mouse_pos, but the panel (0,0) snaps to the mouse_pos which doesn't give the full effect of dragging the panel. I experimented with mouse_force, but not going as expected. Any ideas? laugh
Posted By: Rei_Ayanami

Re: Draging a panel? - 10/20/09 18:31

Hm, why donīt you take the distance between the panel and the mouse_pos?

In the moment left mouse is clicked you save this, and than start a while loop - I īll make an example for - just two minutes laugh
Posted By: Quad

Re: Draging a panel? - 10/20/09 18:31

ok do it this way:

store the mouse position relative to the panel, ie lets say panel is at 120,120 of the screen and the mouse is at 125,140 at the moment of the panel is clicked.

then you get the diffrence on x and y, in our cas there is 5 diffrence on x and 20 diffrence on y.

store these on the variables like y_diff and x_diff and set this vars when the panels are clicked.

then change your panel's pos accordingly like

panel.pos_x = mouse_pos.x - x_diff;
panel.pos_y = mouse_pos.y - y_diff;

i guess i explained it in a little confusing way, if you dont understand what i am talking about, i can make a small example app.

aww rei replied before me and i did not saw that. and made an example:
Code:
BMAP* dummy_bmap = "#256x256x24";

void drag_me(PANEL* panel){
	var x_diff = mouse_pos.x - panel.pos_x;
	var y_diff = mouse_pos.y - panel.pos_y;
	while(mouse_left){
		panel.pos_x = mouse_pos.x - x_diff;
		panel.pos_y = mouse_pos.y - y_diff;
		wait(1);
	}
}

void drag_event(PANEL* panel){
	if(event_type == EVENT_CLICK){
		drag_me(panel);
	}
}
PANEL* draggable_panel = {
	bmap = dummy_bmap;
	event = drag_event;
	flags = SHOW;
}

void main(){
	mouse_mode = 4;
	vec_set(screen_color,vector(128,128,128));
}



code is standalone, it doesnt need any external images etc. just copy/paste and run.

edit2: rei also posted an example seconds before me >.<
anyway this gives you 2 examples grin
Posted By: Rei_Ayanami

Re: Draging a panel? - 10/20/09 18:41

Here is you code:
Code:
PANEL* test_pan =
{
	bmap = "cool.bmp";
	layer = 5;
	flags = SHOW;
}

function drag()
{
	var diff_x, diff_y;
	while(1)
	{
		if((mouse_left)&&(mouse_pos.x >= test_pan.pos_x)&&(mouse_pos.x <= test_pan.pos_x+bmap_width(test_pan.bmap))&&(mouse_pos.y >= test_pan.pos_y)&&(mouse_pos.y <= test_pan.pos_x+bmap_height(test_pan.bmap)))
		{
			diff_x = mouse_pos.x - test_pan.pos_x;
			diff_y = mouse_pos.y - test_pan.pos_y;
			while(mouse_left)
			{
				test_pan.pos_x = mouse_pos.x - diff_x;
				test_pan.pos_y = mouse_pos.y - diff_y;
				wait(1);
			}
		}
		wait(1);
	}
}



And this in the main:
Code:
....
drag();
	while(1)
	{
		mouse_pos.x = mouse_cursor.x;
		mouse_pos.y = mouse_cursor.y;
		wait(1);
	}


Posted By: gfxExp

Re: Draging a panel? - 10/20/09 19:23

Thanks Quad and Rei! Works great! These examples also showed me how things can be done in different ways as well. laugh
Posted By: Nicholas

Re: Draging a panel? - 12/08/09 17:28

To add upon this idea, how would I keep the panel from being dragged out of a specific bounding box. ie. if windowed, I don't want to drag it off screen or up too high over my static menu at the top.
I've tried adding " && sender.pos_x <= 600" to the while mouse_left loop, but if I drag really fast it will go past the bounding box and have to snap back... doesn't look good, I need it to be smooth and just stop at the edge of the predefined area.
© 2024 lite-C Forums