question

Visakh Sakulan avatar image
1 Like"
Visakh Sakulan asked Phil BoBo edited

Can I have the custom GUI in the model Floor ?

gui.fsm

I have build a model with a custom GUI. The GUI consist of a button, which when pressed close the output port of the rack . I would like to know weather this GUI button can be added to the model floor (or as a screen locked button).

note: the button should be present in the model at all time

custom guiflexsim 2016
gui.fsm (27.5 KiB)
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

1 Answer

·
Sam Stubbs avatar image
6 Likes"
Sam Stubbs answered Phil BoBo edited

So if you want to use the GUI as is, go into its properties, and under the GUI Options menu at the top of the properties window, you can select the "Assign the GUI to the "Control" button" which will at least let you click on the Model Control GUI button at the top to open the GUI as a window.

However, we were also able to create a 3D object that acts as a button out on your model floor. We did this by dragging out and resizing a basic Fixed Resource and some 3D text. Then in the FR properties, under the Advanced tab and in the Advanced functions field, we entered this custom code:

/**Handle click messages.*/
treenode current = ownerobject(c);
int msgtype = param(1);


switch (msgtype)
{
	case ADV_FUNC_CLICK:
	{
		int clickCode = param(3);
		switch (clickCode) {
			case LEFT_PRESS:
			{
				setcolor(current,200,200,255);
			} break;
			case LEFT_RELEASE:
			{
				setselectedobject(activedocumentnode(),0);
				colorwhite(current);
				executefsnode(label(current,"onPress"),label(current,"onPress"));
			} break;
			case DOUBLE_CLICK:
			{
				;
			} break;
			case RIGHT_PRESS:
			{
				;
			} break;
			case RIGHT_RELEASE:
			{
				;
			} break;
		}
	} break;
}

This essentially creates the button to have "click" functions that will create a color highlight on click, and call whatever function is in the OnPress label on the object. Finally, we set that OnPress label (under the Labels tab) to be the same function called by your GUI button. (In this case closeoutput(Rack))

We've reattached your model below so you can look at the changes.

3dbutton.fsm


buttonlabel.png (4.8 KiB)
buttonpush.gif (190.1 KiB)
3dbutton.fsm (30.3 KiB)
· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Visakh Sakulan avatar image Visakh Sakulan commented ·

@Sam Stubbs Thank you.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.