HSP sun HSP Programming Guide

HSP Guide [10]

GUI Controles

HSP says, "object" the button and the checkbox control arranged in the window. HSP can prepare the list box of the input box, the message box, and the combo box besides this and six kinds of objects be prepared by a standard instruction. It is a course of the button and the check box here.

The position where the object is displayed is specified by using "pos" instruction. The size in which the object is displayed is specified by using "objsize" instruction. To change the character font of the object, the "font" instruction is called. When the "objmode" instruction is called, the font is applied for the object in addition to this.

The numerical value "object ID" comes out in HSP. This is a figure allotted from 0 whenever the object is arranged. When system variable "stat" immediately after the instruction that arranges the object is seen, the numerical value of object ID is substituted.

Button

The button is an object to have square shape, and the character is displayed on the button. "Button instruction" is used. Processing moves to the label specified that the button is pushed.

//	put button
	button "Button 1",*osu1
	mes "object ID:"+stat+""

	pos 150,100	// position
	objsize 150,50	// size
	button "button 2",*osu2
	mes "object ID:"+stat+""

	stop

//	when button pushed, jump this label
*osu1
	mes "Pushed Button 1"
	stop

*osu2
	mes "Pushed Button 2"
	stop

Button and objprm instruction

"objprm" instruction is used for changing the character displayed in the button after the button is set up. Object ID on is specified for the first parameter. Object ID at the jumping flight destination (label) is substitution s in system variable "stat" for the button.

//	put button
	button "Button 1",*osu1	//	object ID 0
	button "Button 2",*osu2	//	object ID 1

	stop

*osu1
	objprm stat,"Change"	// stat is pushed object ID 0
	stop

*osu2
//	randam value
	objprm stat,rnd(100)	// stat is pushed object ID 1
	stop

An asunder numerical value (random value) is displayed in pushing the second button.

Chckbox

The check box is an object with the part where the part and the character of a square check item are displayed. The state changes by putting and removing the check. "chkbox" instruction is used. To confirm whether the check is or doesn't exist, the variable of the first parameter is seen.

	pos 50,50	// position
	objsize 100,30	// size

//	put checkbox
	chkbox "checkbox A",c1
	chkbox "checkbox B",c2
	chkbox "checkbox C",c3
	chkbox "checkbox D",c4

	button "check",*check

	stop

*check
	mes "A:"+c1+" / B:"+c2+" / C:"+c3+" / D:"+c4+""
	stop

0 is substitution in the variable if there are 1 nor a check if there is a check in the check box. If one is specified for this variable beforehand, it becomes a check box with the check at the stage where the check box is arranged.

	c2=1
	c4=1

//	put checkbox
	chkbox "checkbox A",c1
	chkbox "checkbox B",c2
	chkbox "checkbox C",c3
	chkbox "checkbox D",c4

	stop

Checkbox and objprm instruction

The check mark is put, it removes, and "objprm" instruction is used arranging the check box by "chkbox" instruction. The check comes off when 0 is specified for the first parameter by the second parameter in object ID, and the check adheres when one is specified.

//	put checkbox
	chkbox "HSP Guide",c1

	button "ON/OFF",*onoff
	stop

*onoff
	if c1=1{
//		check off
		objprm 0,0
	}else{
//		check on
		objprm 0,1
	}

< Prev | Next >

About

Welcome to HSP sun. Here is a site to introduces HSP, a free script language system.

Menu

Copyright(c) HSP sun [HSP]

inserted by FC2 system