Specify the exact position of a window in a screen

This forum is for general developer support questions.
AmiHyperion
Posts: 28
Joined: Tue Aug 30, 2011 8:26 am

Re: Specify the exact position of a window in a screen

Post by AmiHyperion »

I'm getting mad.

I want to realize a sort of navigation panel as follow

Three rows with 3 button each, inside a BVS_Group. The following is my attempt to make it. It consider only 4 buttons atm. The first three buttons are ok, but the fourth button is showed on the first row too

Code: Select all

f ((winobj = IIntuition->NewObject (WindowClass,NULL,
				WA_PubScreen, scr, 
				//WA_Title, iwt, 
				WA_Flags, WFLG_ACTIVATE, 
				WA_IDCMP, IDCMP_VANILLAKEY | IDCMP_INTUITICKS, 
				WA_Width, scr->Width * 4/ 10, 
				WA_Height, 390,
				WA_Top, 720,
				WA_Left,1400, 
				WINDOW_NewMenu,newmenu,
				WINDOW_BackFillName, "Sys:Prefs/Presets/Patterns/Chalk/ChalkBlue.brush",
				WINDOW_ParentGroup, IIntuition->NewObject (LayoutClass,NULL,
					LAYOUT_Orientation, LAYOUT_ORIENT_VERT, 
					LAYOUT_SpaceOuter, TRUE, 
						LAYOUT_AddChild, IIntuition->NewObject(LayoutClass, NULL,
							LAYOUT_BevelStyle,  BVS_GROUP,
							LAYOUT_Orientation, LAYOUT_ORIENT_HORIZ,
							LAYOUT_Label,       " N A V I G A T I O N ",
								//LAYOUT_AddChild, /*LayoutObject,*/
                 				//	IIntuition->NewObject(NULL, "layout.gadget",
								//	LAYOUT_VertAlignment, LALIGN_CENTER,
								//	LAYOUT_HorizAlignment, LALIGN_CENTER,
									LAYOUT_AddChild, IIntuition->NewObject (LayoutClass,NULL,
									LAYOUT_Orientation, LAYOUT_ORIENT_HORIZ, 
									LAYOUT_SpaceOuter, TRUE,
									LAYOUT_AddChild, gadgets[OBJ_BUT1] = /*ButtonObject,*/
                        					IIntuition->NewObject(NULL, "button.gadget",
                            					GA_ID, OBJ_BUT1,
                            					//GA_Left,  10,
                            					//GA_Top,  10,
												BUTTON_BevelStyle, BVS_NONE,
												BUTTON_Transparent, TRUE,
												BUTTON_RenderImage, gadgets[OBJ_BUT1_UNSEL] = /*BitMapObject,*/
                        					IIntuition->NewObject(NULL, "bitmap.image",
												BITMAP_SourceFile, "images/AUP.png",
												BITMAP_DisabledSourceFile, "images/Object1.png",
												BITMAP_Screen, scr,
												BITMAP_Masking, TRUE,
											TAG_END),
												BUTTON_SelectImage, gadgets[OBJ_BUT1_SEL] = /*BitMapObject,*/
                        					IIntuition->NewObject(NULL, "bitmap.image",
												BITMAP_SourceFile, "images/Object1.png",
												BITMAP_Screen, scr,
												BITMAP_Masking, TRUE,	
											TAG_END),
									TAG_END),
									LAYOUT_AddChild, gadgets[OBJ_BUT2] = /*ButtonObject,*/
                        					IIntuition->NewObject(NULL, "button.gadget",
                            					GA_ID, OBJ_BUT2,
												BUTTON_BevelStyle, BVS_NONE,
												BUTTON_Transparent, TRUE,
												BUTTON_RenderImage, gadgets[OBJ_BUT2_UNSEL] = /*BitMapObject,*/
                        					IIntuition->NewObject(NULL, "bitmap.image",
												BITMAP_SourceFile, "images/AUP.png",
												BITMAP_DisabledSourceFile, "images/Object1.png",
												BITMAP_Screen, scr,
												BITMAP_Masking, TRUE,
											TAG_END),
												BUTTON_SelectImage, gadgets[OBJ_BUT2_SEL] = /*BitMapObject,*/
                        					IIntuition->NewObject(NULL, "bitmap.image",
												BITMAP_SourceFile, "images/Object1.png",
												BITMAP_Screen, scr,
												BITMAP_Masking, TRUE,	
											TAG_END),
									TAG_END),
									LAYOUT_AddChild, gadgets[OBJ_BUT3] = /*ButtonObject,*/
                        					IIntuition->NewObject(NULL, "button.gadget",
                            					GA_ID, OBJ_BUT3,
												BUTTON_BevelStyle, BVS_NONE,
												BUTTON_Transparent, TRUE,
												BUTTON_RenderImage, gadgets[OBJ_BUT3_UNSEL] = /*BitMapObject,*/
                        					IIntuition->NewObject(NULL, "bitmap.image",
												BITMAP_SourceFile, "images/AUP.png",
												BITMAP_DisabledSourceFile, "images/Object1.png",
												BITMAP_Screen, scr,
												BITMAP_Masking, TRUE,
											TAG_END),
												BUTTON_SelectImage, gadgets[OBJ_BUT3_SEL] = /*BitMapObject,*/
                        					IIntuition->NewObject(NULL, "bitmap.image",
												BITMAP_SourceFile, "images/Object1.png",
												BITMAP_Screen, scr,
												BITMAP_Masking, TRUE,	
											TAG_END),
									TAG_END),
						TAG_END),				
								LAYOUT_AddChild, IIntuition->NewObject (LayoutClass,NULL,
										LAYOUT_Orientation, LAYOUT_ORIENT_HORIZ, 
										LAYOUT_SpaceOuter, TRUE,
										LAYOUT_AddChild, gadgets[OBJ_BUT4] = /*ButtonObject,*/
	                        					IIntuition->NewObject(NULL, "button.gadget",
	                            					GA_ID, OBJ_BUT4,
													BUTTON_BevelStyle, BVS_NONE,
													BUTTON_Transparent, TRUE,
													BUTTON_RenderImage, gadgets[OBJ_BUT4_UNSEL] = /*BitMapObject,*/
	                        					IIntuition->NewObject(NULL, "bitmap.image",
													BITMAP_SourceFile, "images/AUP.png",
													BITMAP_DisabledSourceFile, "images/Object1.png",
													BITMAP_Screen, scr,
													BITMAP_Masking, TRUE,
												TAG_END),
													BUTTON_SelectImage, gadgets[OBJ_BUT4_SEL] = /*BitMapObject,*/
	                        					IIntuition->NewObject(NULL, "bitmap.image",
													BITMAP_SourceFile, "images/Object1.png",
													BITMAP_Screen, scr,
													BITMAP_Masking, TRUE,	
												TAG_END),
										TAG_END),
								TAG_END),
						TAG_END),
						TAG_END),
						
			TAG_END)));
User avatar
salass00
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 534
Joined: Sat Jun 18, 2011 4:12 pm
Location: Finland
Contact:

Re: Specify the exact position of a window in a screen

Post by salass00 »

AmiHyperion wrote:I'm getting mad.

I want to realize a sort of navigation panel as follow

Three rows with 3 button each, inside a BVS_Group. The following is my attempt to make it. It consider only 4 buttons atm. The first three buttons are ok, but the fourth button is showed on the first row too
I don't see how you intend to do that by adding horizontal layouts containing your rows of buttons to a horizontal layout. If you want to get three rows with one button each you should have either a layout like this:

Code: Select all

LAYOUT_AddChild, IIntuition->NewObject(LayoutClass, NULL, /* vertical layout */
    LAYOUT_Orientation, LAYOUT_ORIENT_VERT,
    LAYOUT_AddChild, IIntuition->NewObject(LayoutClass, NULL, /* row 1 */
        LAYOUT_Orientation, LAYOUT_ORIENT_HORIZ,
        /* Add buttons here */
    TAG_END),
    LAYOUT_AddChild, IIntuition->NewObject(LayoutClass, NULL, /* row 2 */
        LAYOUT_Orientation, LAYOUT_ORIENT_HORIZ,
        /* Add buttons here */
    TAG_END),
    LAYOUT_AddChild, IIntuition->NewObject(LayoutClass, NULL, /* row 3 */
        LAYOUT_Orientation, LAYOUT_ORIENT_HORIZ,
        /* Add buttons here */
    TAG_END),
TAG_END),
or you could do a column oriented version:

Code: Select all

LAYOUT_AddChild, IIntuition->NewObject(LayoutClass, NULL, /* horizontal layout */
    LAYOUT_Orientation, LAYOUT_ORIENT_HORIZ,
    LAYOUT_AddChild, IIntuition->NewObject(LayoutClass, NULL, /* column 1 */
        LAYOUT_Orientation, LAYOUT_ORIENT_VERT,
        /* Add buttons here */
    TAG_END),
    LAYOUT_AddChild, IIntuition->NewObject(LayoutClass, NULL, /* column 2 */
        LAYOUT_Orientation, LAYOUT_ORIENT_VERT,
        /* Add buttons here */
    TAG_END),
    LAYOUT_AddChild, IIntuition->NewObject(LayoutClass, NULL, /* column 3 */
        LAYOUT_Orientation, LAYOUT_ORIENT_VERT,
        /* Add buttons here */
    TAG_END),
TAG_END),
AmiHyperion
Posts: 28
Joined: Tue Aug 30, 2011 8:26 am

Re: Specify the exact position of a window in a screen

Post by AmiHyperion »

" If you want to get three rows with one button each you should have either a layout like this:"

I need three rows each with three buttons all inside the BVS_GROUP.
User avatar
salass00
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 534
Joined: Sat Jun 18, 2011 4:12 pm
Location: Finland
Contact:

Re: Specify the exact position of a window in a screen

Post by salass00 »

AmiHyperion wrote:" If you want to get three rows with one button each you should have either a layout like this:"

I need three rows each with three buttons all inside the BVS_GROUP.
So just add the BVS_GROUP bevel style to the parent layout (the one that contains the row/column layouts).
AmiHyperion
Posts: 28
Joined: Tue Aug 30, 2011 8:26 am

Re: Specify the exact position of a window in a screen

Post by AmiHyperion »

I will try, thank you.

I thought I had done well as in the code i posted. :(
User avatar
gazelle
Posts: 102
Joined: Sun Mar 04, 2012 12:49 pm
Location: Frohnleiten, Austria

Re: Specify the exact position of a window in a screen

Post by gazelle »

AmiHyperion wrote:I thought I had done well as in the code i posted.
Well, change your second layout to vertical and it should be fine.

You have:

Code: Select all

LAYOUT_Orientation, LAYOUT_ORIENT_VERT,
	LAYOUT_Orientation, LAYOUT_ORIENT_HORIZ,
		LAYOUT_Orientation, LAYOUT_ORIENT_HORIZ,
			OBJ_BUT1,
			OBJ_BUT2,
			OBJ_BUT3,
		LAYOUT_Orientation, LAYOUT_ORIENT_HORIZ,
			OBJ_BUT4,
But you want:

Code: Select all

LAYOUT_Orientation, LAYOUT_ORIENT_VERT,
	LAYOUT_Orientation, LAYOUT_ORIENT_VERT,
		LAYOUT_Orientation, LAYOUT_ORIENT_HORIZ,
			OBJ_BUT1,
			OBJ_BUT2,
			OBJ_BUT3,
		LAYOUT_Orientation, LAYOUT_ORIENT_HORIZ,
			OBJ_BUT4,
AmiHyperion
Posts: 28
Joined: Tue Aug 30, 2011 8:26 am

Re: Specify the exact position of a window in a screen

Post by AmiHyperion »

Thank you, both.
It's works now.

It's a long piece of code for 9 buttons.

Btw, there's too much space beetween each rows and columns. How to reduce it?

I tried with "LAYOUT_FixedHoriz, FALSE," and the space is reduced, but all the button become aligned to the left window border
chris
Posts: 564
Joined: Sat Jun 18, 2011 12:05 pm
Contact:

Re: Specify the exact position of a window in a screen

Post by chris »

AmiHyperion wrote:Btw, there's too much space beetween each rows and columns. How to reduce it?
Try LAYOUT_ShrinkWrap, TRUE
User avatar
salass00
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 534
Joined: Sat Jun 18, 2011 4:12 pm
Location: Finland
Contact:

Re: Specify the exact position of a window in a screen

Post by salass00 »

AmiHyperion wrote: Btw, there's too much space beetween each rows and columns. How to reduce it?
Set LAYOUT_SpaceInner to FALSE.
AmiHyperion
Posts: 28
Joined: Tue Aug 30, 2011 8:26 am

Re: Specify the exact position of a window in a screen

Post by AmiHyperion »

Tried both, same result.
Post Reply