1. Help with Control Behavior

This is a multi-part message in MIME format.

------=_NextPart_000_002C_01C2F448.951CCAF0
	charset="iso-8859-1"

I'm attaching the latest version of my CCG Deck Designer. Two questions:

1. Why does the Card list act as though it is calculated based on a
percentage instead of how it's actually calculated, based on a pixel
position? To see this, watch how the bottom of the "Cards" list behaves
compared to the bottom of the "Card Attributes" list when you make the main
window higher/lower...
2. Why do I have to use such large negative numbers to position some of the
elements? (See line 84, " manage( GMID , grid1 , {0,5}, {0,45}, {1,-180},
{bttn_AddAttr,-5} )" ). Why the -180?! I expect to be able to use {1,-5} or
something.

Thanks!

-ck

------=_NextPart_000_002C_01C2F448.951CCAF0
Content-Type: application/octet-stream;
	name="ccg_cardmaker.exw"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="ccg_cardmaker.exw"

--  code generated by Win32Lib IDE v0.16.0

=20
-- CCG Card List Creator
-- v0.1.0
-- by cklester

include Win32Lib.ew
without warning

-- this is intro code

include xControls.ew
include eugrid.ew

object junk
sequence cards -- the big list of cards
sequence attributes -- attribute names
					-- will serve as a card template for now

constant CARDNAME =3D 1

cards =3D {}
attributes =3D { "Name" }

-- end intro code

-------------------------------------------------------------------------=
-------
--  Window Window1
constant Window1 =3D createEx( Window, "CCG Simulator Deck Designer", 0, =
Default, Default, 475, 480, 0, 0 )
constant menu_file =3D createEx( Menu, "File", Window1, 0, 1, 0, 0, 0, 0 =
)
constant menu_filenewdeck =3D createEx( MenuItem, "New Deck", menu_file, =
0, 2, 0, 0, 0, 0 )
constant menu_fileopen =3D createEx( MenuItem, "Open Deck", menu_file, =
0, 3, 0, 0, 0, 0 )
constant menu_filesave =3D createEx( MenuItem, "Save Deck", menu_file, =
0, 4, 0, 0, 0, 0 )
constant menu_fileexit =3D createEx( MenuItem, "Exit", menu_file, 0, 5, =
0, 0, 0, 0 )
constant grp_attr =3D createEx( Group, "Card Attributes", Window1, 180, =
40, 276, 364, 0, 0 )
constant bttn_AddAttr =3D createEx( PushButton, "Add", grp_attr, 76, =
332, 60, 24, 0, 0 )
constant bttn_RemoveAttr =3D createEx( PushButton, "Remove", grp_attr, =
144, 332, 60, 24, 0, 0 )
constant list_cardattr =3D createEx( ListView, {"Attribute","Value"}, =
grp_attr, 12, 280, 252, 44, =
or_all({LVS_REPORT,LVS_SHOWSELALWAYS,LVS_SINGLESEL}), 0 )
atom lvMask=20
integer lvOk=20
lvMask =3D or_all({LVS_EX_GRIDLINES})
lvOk =3D =
sendMessage(list_cardattr,LVM_SETEXTENDEDLISTVIEWSTYLE,lvMask,lvMask)
constant grp_cards =3D createEx( Group, "Cards", Window1, 12, 40, 160, =
364, 0, 0 )
constant list_cards =3D createEx( List, "Card List", grp_cards, 8, 20, =
144, 304, 0, 0 )
constant bttn_AddCard =3D createEx( PushButton, "Add", grp_cards, 16, =
332, 60, 24, 0, 0 )
constant bttn_RemoveCard =3D createEx( PushButton, "Remove", grp_cards, =
84, 332, 60, 24, 0, 0 )
---------------------------------------------------------
-------------------------------------------------------------------------=
-------
-- begin general code

-- EuGrid control
constant
	grid1 =3D EGW_CreateGrid( grp_attr, 10, 30, 275, 295, True ),
	grid1col1 =3D EGW_AddColumn(grid1, "Name", 100, EGW_LAST, EGW_EDIT, 1 =
),
	grid1col2 =3D EGW_AddColumn(grid1, "Value", 100, EGW_LAST, EGW_EDIT, 2 =
)

	junk =3D EGW_SetGridProperty( grid1, EGW_ROW_HEADER_WIDTH, 0)

-- xControls assignments
constant
--	LSID =3D xControl( LimitSize, "", Window1, 475, 480, 640, 480, 0, 0 =
),
	LSID =3D xControl( LimitSize, "", Window1, 475, 480, 640, 768, 0, 0 ),
	GMID =3D xControl( Geometry, "", Window1, 0, 0, 0, 0, 0, 0 )

	manage( GMID , grp_cards , {0,0}, {0,40}, {0,160}, {1,-5} )
	manage( GMID , bttn_AddCard , {0,5}, {grp_cards,-75} , {bttn_AddCard, =
60}, {bttn_AddCard,24} )
	manage( GMID , bttn_RemoveCard , {bttn_AddCard,15}, =
{grp_cards,-75},{bttn_RemoveCard,60},{bttn_RemoveCard,24} )
	manage( GMID , list_cards , {0,5}, {0,45}, {0,150}, {bttn_AddCard,-5} )
=09
	manage( GMID , grp_attr , {grp_cards,5}, {0,40}, {1,-5}, {1,-5} )
	manage( GMID , bttn_AddAttr , {0,5}, {grp_attr,-75} , {bttn_AddAttr, =
60}, {bttn_AddAttr,24} )
	manage( GMID , bttn_RemoveAttr , {bttn_AddAttr,15} , =
{grp_attr,-75},{bttn_RemoveAttr,60},{bttn_RemoveAttr,24} )
	manage( GMID , grid1 , {0,5}, {0,45}, {1,-180}, {bttn_AddAttr,-5} )

manage_now( LSID )
manage_now( GMID )

-- end xControls assignments

procedure do_something( sequence msg )
	junk =3D message_box( msg , "Doing Something" , MB_OK )
end procedure

procedure show_card_attributes( object cardnum )
sequence card_attr
	-- show the attributes for card number OR card named
	if atom(cardnum) then
		-- it's a card number
		card_attr =3D cards[ cardnum ]
	else
		-- it's a card name
		-- find the name
		-- set card_attr =3D cards[ cardfound ]
	end if

	-- updates the attributes list
	eraseItems( list_cardattr )
	for t=3D1 to length( attributes ) do
		junk =3D attributes[t]
		junk =3D card_attr[t]
		junk =3D addLVItem( {list_cardattr,-1}, 0, =
{attributes[t],card_attr[t]} )
	=09
		junk =3D EGW_LoadData( grid1, { attributes[t] , card_attr[t] } , t )
	end for

end procedure

procedure update_card_list()
	-- make sure the list is up-to-date with all cards
	eraseItems( list_cards )
	for t=3D1 to length( cards ) do
		addItem( list_cards , cards[t][CARDNAME] )
	end for
end procedure

procedure removeCard( atom which )
	cards =3D cards[1..which-1] & cards[which+1..length(cards)]
	update_card_list()
	show_card_attributes( 1 )
end procedure

procedure addCard( sequence cardname )
sequence newCard
	-- add new record to cards db
	for t=3D1 to length( cards ) do
		if equal( cards[t][CARDNAME] , cardname ) then
			cardname &=3D "1"
		end if
	end for
	--cards =3D append( cards , { { cardname } } )
	newCard =3D repeat({},length(attributes))
	newCard[1] =3D cardname
	cards &=3D { newCard }
	update_card_list()
end procedure

procedure addAttribute( sequence attrname )
	attributes =3D append( attributes , attrname )
	-- add this field to all cards
	for t=3D1 to length(cards) do
		cards[t] =3D append( cards[t], "unknown" )
	end for
end procedure

procedure removeAttr( atom which )
-- remove attribute #which from list and from cards
	attributes =3D attributes[1..which-1] & =
attributes[which+1..length(attributes)]
	for t=3D1 to length(cards) do
		cards[t] =3D cards[t][1..which-1] & =
cards[t][which+1..length(cards[t])]
	end for
	update_card_list()
	-- select card #1
	setFocus( list_cards )
	show_card_attributes( 1 )
end procedure

-- end general code
-------------------------------------------------------------------------=
-------
procedure menu_filenewdeck_onClick (integer self, integer event, =
sequence params)--params is ()
	cards =3D {}
	attributes =3D { "Name" }
	update_card_list()
end procedure
setHandler( menu_filenewdeck, w32HClick, =
routine_id("menu_filenewdeck_onClick"))
-------------------------------------------------------------------------=
-------
procedure menu_filesave_onClick (integer self, integer event, sequence =
params)--params is ()
	-- save this to a EUPH database
end procedure
setHandler( menu_filesave, w32HClick, =
routine_id("menu_filesave_onClick"))
-------------------------------------------------------------------------=
-------
procedure menu_fileexit_onClick (integer self, integer event, sequence =
params)--params is ()
-- make sure everything's saved 'n' all...
	closeWindow ( Window1 )
end procedure
setHandler( menu_fileexit, w32HClick, =
routine_id("menu_fileexit_onClick"))
-------------------------------------------------------------------------=
-------
procedure list_cards_onClick (integer self, integer event, sequence =
params)--params is ()
	if length(cards) > 0 then
		show_card_attributes( getIndex( list_cards ) )	=09
	end if
end procedure
setHandler( list_cards, w32HClick, routine_id("list_cards_onClick"))
-------------------------------------------------------------------------=
-------
procedure bttn_AddCard_onClick (integer self, integer event, sequence =
params)--params is ()
	addCard( "Unnamed Card" )
end procedure
setHandler( bttn_AddCard, w32HClick, routine_id("bttn_AddCard_onClick"))
-------------------------------------------------------------------------=
-------
procedure bttn_RemoveCard_onClick (integer self, integer event, sequence =
params)--params is ()
	removeCard( getIndex( list_cards ) )
end procedure
setHandler( bttn_RemoveCard, w32HClick, =
routine_id("bttn_RemoveCard_onClick"))
-------------------------------------------------------------------------=
-------
procedure bttn_AddAttr_onClick (integer self, integer event, sequence =
params)--params is ()
	addAttribute("Unnamed")
end procedure
setHandler( bttn_AddAttr, w32HClick, routine_id("bttn_AddAttr_onClick"))
-------------------------------------------------------------------------=
-------
procedure bttn_RemoveAttr_onClick (integer self, integer event, sequence =
params)--params is ()
	junk =3D getIndex( list_cardattr )
	removeAttr( junk[1] )
end procedure
setHandler( bttn_RemoveAttr, w32HClick, =
routine_id("bttn_RemoveAttr_onClick"))


WinMain( Window1,Normal )

------=_NextPart_000_002C_01C2F448.951CCAF0--

new topic     » topic index » view message » categorize

2. Re: Help with Control Behavior

On Thu, 27 Mar 2003 10:06:49 -0600, C. K. Lester <cklester at yahoo.com> 
wrote:

>
> I'm attaching the latest version of my CCG Deck Designer. Two questions:
>
> 1. Why does the Card list act as though it is calculated based on a
> percentage instead of how it's actually calculated, based on a pixel
> position? To see this, watch how the bottom of the "Cards" list behaves
> compared to the bottom of the "Card Attributes" list when you make the 
> main
> window higher/lower...
> 2. Why do I have to use such large negative numbers to position some of 
> the
> elements? (See line 84, " manage( GMID , grid1 , {0,5}, {0,45}, {1,-180},
> {bttn_AddAttr,-5} )" ). Why the -180?! I expect to be able to use {1,-5} 
> or
> something.

Try creating the ListBox with the 'LBS_NOINTEGRALHEIGHT' style flag.

-- 

cheers,
Derek Parnell

new topic     » goto parent     » topic index » view message » categorize

3. Re: Help with Control Behavior

----- Original Message -----
From: "C. K. Lester" <cklester at yahoo.com>
To: "EUforum" <EUforum at topica.com>
Subject: RE: Help with Control Behavior


>
>
> Derek Parnell wrote:
> >
> > Try creating the ListBox with the 'LBS_NOINTEGRALHEIGHT' style flag.
>
> Derek,
>
> That didn't help.
>

Okay, maybe I didn't understand your problem then, because the effect I saw
was fixed by this flag.

What I saw was the List (not listview) height was not being changed smoothly
when the window height changed. Instead it would change in a 'jerky' manner.
So I added that flag thus....

 constant list_cards = createEx( List, "Card List", grp_cards, 8, 20, 144,
304,
                 LBS_NOINTEGRALHEIGHT, 0 )

and after that the List height changed smoothly.

What is the problem that you see?

----------------
cheers,
Derek Parnell

new topic     » goto parent     » topic index » view message » categorize

4. Re: Help with Control Behavior

On Thursday 27 March 2003 04:27 pm, you wrote:

> Try creating the ListBox with the 'LBS_NOINTEGRALHEIGHT' style flag.

Derek, when I put it in the right place, it works. :)

Thanks!

new topic     » goto parent     » topic index » view message » categorize

5. Re: Help with Control Behavior

On Friday 28 March 2003 02:53 pm, you wrote:
>
> What I saw was the List (not listview) height was not being changed
> smoothly when the window height changed. Instead it would change in a
> 'jerky' manner. So I added that flag thus....
>
>  constant list_cards = createEx( List, "Card List", grp_cards, 8, 20, 144,
> 304,
>                  LBS_NOINTEGRALHEIGHT, 0 )
>
> and after that the List height changed smoothly.
>
> What is the problem that you see?

The problem was, I put it in the ExStyle (I think). I didn't see the other 
Style box in the IDE 'til later. Then when I put it there, miracles 
happened!!!!

:)

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu