Re: xControls Questions

new topic     » goto parent     » topic index » view thread      » older message » newer message

This is a multi-part message in MIME format.

------=_NextPart_000_012B_01C2F39A.07EB9CF0
	charset="iso-8859-1"

> I use xControls all the time but don't think I've ever tried to make a
> group resizable.  Perhaps you could post an example?

Maybe it's against standard procedure to make a "group" control
resizable...? If so, no biggie... I'll just rework my form. However, I'm
attaching the IDE output I've got so far. Notice that the "Add" button for
the Card group is missing...

I'm also attaching the IDE prj file, in case anybody wants to help out. :)

Thanks,
ck

P.S. This program is going to be a CCG database manager. I have several
ideas for CCGs and I wanted a way to simulate them on a PC. So, this is the
first step... building and managing the card set.

------=_NextPart_000_012B_01C2F39A.07EB9CF0
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

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 Card Designer", 0, =
Default, Default, 474, 473, 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_AddAttribute =3D createEx( PushButton, "Add", grp_attr, =
76, 332, 60, 24, 0, 0 )
constant bttn_Remove =3D createEx( PushButton, "Remove", grp_attr, 144, =
332, 60, 24, 0, 0 )
constant list_cardattr =3D createEx( ListView, {"Attribute","Value"}, =
grp_attr, 12, 16, 252, 304, =
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

-- xControls assignments

constant
	GMID =3D xControl( Geometry, "", Window1, 0, 0, 0, 0, 0, 0 )

manage( GMID , grp_cards , {0,0}, {0,40}, {0,160}, {0.95,0} )
manage( GMID , grp_attr , {grp_cards,5}, {0,40}, {1,-5}, {0.95,0} )

--manage( GMID , list_cards , {grp_cards,5}, {grp_cards,5}, =
{grp_cards,-5}, {grp_cards,-5} )
manage( GMID , bttn_AddCard , {grp_cards,16}, {0.90,0}, =
{bttn_AddCard,60}, {bttn_AddCard,24} )

-- 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]} )
	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_fileexit_onClick (integer self, integer event, sequence =
params)--params is ()
	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_AddAttribute_onClick (integer self, integer event, =
sequence params)--params is ()
	addAttribute("Unnamed")
end procedure
setHandler( bttn_AddAttribute, w32HClick, =
routine_id("bttn_AddAttribute_onClick"))
-------------------------------------------------------------------------=
-------
procedure bttn_Remove_onClick (integer self, integer event, sequence =
params)--params is ()
	junk =3D getIndex( list_cardattr )
	removeAttr( junk[1] )
end procedure
setHandler( bttn_Remove, w32HClick, routine_id("bttn_Remove_onClick"))


WinMain( Window1,Normal )

------=_NextPart_000_012B_01C2F39A.07EB9CF0
Content-Type: application/octet-stream;
	name="ccg_cardmaker.prj"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="ccg_cardmaker.prj"

#Version 0.16.0
#Counter: 33
#WinCounter: 1
#Window 1
#Control: Window1
X       : 0
Y       : 0
CX      : 474
CY      : 473
Title   : CCG Simulator Card Designer
Class   : Window
Enabled : 0
Checked : 0
Parent  :=20
PClass  :=20
Visible : 1
BkColor : 0
EnableC : 1
Style   : 0
TypStyle:=20
ExStyle : 0
Local : 1

#Proc: (General)
-- begin general code

-- xControls assignments

constant
	GMID =3D xControl( Geometry, "", Window1, 0, 0, 0, 0, 0, 0 )

manage( GMID , grp_cards , {0,0}, {0,40}, {0,160}, {0.95,0} )
manage( GMID , grp_attr , {grp_cards,5}, {0,40}, {1,-5}, {0.95,0} )

--manage( GMID , list_cards , {grp_cards,5}, {grp_cards,5}, =
{grp_cards,-5}, {grp_cards,-5} )
manage( GMID , bttn_AddCard , {grp_cards,16}, {0.90,0}, =
{bttn_AddCard,60}, {bttn_AddCard,24} )

-- 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]} )
	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
#EndProc

#Proc: (Intro)
-- this is intro code

include xControls.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

#EndProc

#Proc: (Begin)
-- CCG Card List Creator
-- v0.1.0
-- by cklester

#EndProc

#Control: menu_file
AWindow : 1
X       : 0
Y       : 1
CX      : 0
CY      : 0
Title   : File
Class   : Menu
Enabled : 1
Checked : 0
Parent  :=20
PClass  :=20
Visible : 1
EnableC : 1
Style   : 0
TypStyle:=20
ExStyle : 0
Local : 1

#Control: menu_filenewdeck
AWindow : 1
X       : 0
Y       : 2
CX      : 0
CY      : 0
Title   : New Deck
Class   : MenuItem
Enabled : 1
Checked : 0
Parent  :=20
PClass  :=20
Visible : 1
EnableC : 1
Style   : 0
TypStyle:=20
ExStyle : 0
Local : 1

#Proc: onClick
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"))
#EndProc

#Control: menu_fileopen
AWindow : 1
X       : 0
Y       : 3
CX      : 0
CY      : 0
Title   : Open Deck
Class   : MenuItem
Enabled : 1
Checked : 0
Parent  :=20
PClass  :=20
Visible : 1
EnableC : 1
Style   : 0
TypStyle:=20
ExStyle : 0
Local : 1

#Control: menu_filesave
AWindow : 1
X       : 0
Y       : 4
CX      : 0
CY      : 0
Title   : Save Deck
Class   : MenuItem
Enabled : 1
Checked : 0
Parent  :=20
PClass  :=20
Visible : 1
EnableC : 1
Style   : 0
TypStyle:=20
ExStyle : 0
Local : 1

#Control: menu_fileexit
AWindow : 1
X       : 0
Y       : 5
CX      : 0
CY      : 0
Title   : Exit
Class   : MenuItem
Enabled : 1
Checked : 0
Parent  :=20
PClass  :=20
Visible : 1
EnableC : 1
Style   : 0
TypStyle:=20
ExStyle : 0
Local : 1

#Proc: onClick
procedure menu_fileexit_onClick (integer self, integer event, sequence =
params)--params is ()
	closeWindow ( Window1 )
end procedure
setHandler( menu_fileexit, w32HClick, =
routine_id("menu_fileexit_onClick"))
#EndProc

#Control: grp_cards
AWindow : 5
X       : 12
Y       : 40
CX      : 160
CY      : 364
Title   : Cards
Class   : Group
Enabled : 0
Checked : 0
Parent  :=20
PClass  :=20
Visible : 1
EnableC : 1
Style   : 0
TypStyle:=20
ExStyle : 0
TabOrder : 5
Local : 1

#Control: grp_attr
AWindow : 5
X       : 180
Y       : 40
CX      : 276
CY      : 364
Title   : Card Attributes
Class   : Group
Enabled : 0
Checked : 0
Parent  :=20
PClass  :=20
Visible : 1
EnableC : 1
Style   : 0
TypStyle:=20
ExStyle : 0
TabOrder : 1
Local : 1

#Control: list_cardattr
AWindow : 5
X       : 192
Y       : 56
CX      : 252
CY      : 304
Title   : "Attribute","Value"
Class   : ListView
Enabled : 0
Checked : 0
Parent  : grp_attr
PClass  : Group
Visible : 1
EnableC : 1
Style   : LVS_REPORT,LVS_SHOWSELALWAYS,LVS_SINGLESEL
TypStyle:=20
ExStyle : 0
#ExtExStyle: list_cardattr
LVS_EX_GRIDLINES
#EndExtExStyle

#SelectWidth: list_cardattr
UseColumn
Default
Default
#EndSelectWidth

TabOrder : 4
Local : 1

#Control: list_cards
AWindow : 5
X       : 20
Y       : 60
CX      : 144
CY      : 304
Title   : Card List
Class   : List
Enabled : 0
Checked : 0
Parent  : grp_cards
PClass  : Group
Visible : 1
EnableC : 1
Style   : 0
TypStyle:=20
ExStyle : 0
TabOrder : 6
Local : 1

#Proc: 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"))
#EndProc

#Control: bttn_AddCard
AWindow : 5
X       : 28
Y       : 372
CX      : 60
CY      : 24
Title   : Add
Class   : PushButton
Enabled : 0
Checked : 0
Parent  : grp_cards
PClass  : Group
Visible : 1
EnableC : 1
Style   : 0
TypStyle:=20
ExStyle : 0
TabOrder : 7
Local : 1

#Proc: 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"))
#EndProc

#Control: bttn_RemoveCard
AWindow : 5
X       : 96
Y       : 372
CX      : 60
CY      : 24
Title   : Remove
Class   : PushButton
Enabled : 0
Checked : 0
Parent  : grp_cards
PClass  : Group
Visible : 1
EnableC : 1
Style   : 0
TypStyle:=20
ExStyle : 0
TabOrder : 8
Local : 1

#Proc: 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"))
#EndProc

#Control: bttn_AddAttribute
AWindow : 5
X       : 256
Y       : 372
CX      : 60
CY      : 24
Title   : Add
Class   : PushButton
Enabled : 0
Checked : 0
Parent  : grp_attr
PClass  : Group
Visible : 1
EnableC : 1
Style   : 0
TypStyle:=20
ExStyle : 0
TabOrder : 2
Local : 1

#Proc: onClick
procedure bttn_AddAttribute_onClick (integer self, integer event, =
sequence params)--params is ()
	addAttribute("Unnamed")
end procedure
setHandler( bttn_AddAttribute, w32HClick, =
routine_id("bttn_AddAttribute_onClick"))
#EndProc

#Control: bttn_Remove
AWindow : 5
X       : 324
Y       : 372
CX      : 60
CY      : 24
Title   : Remove
Class   : PushButton
Enabled : 0
Checked : 0
Parent  : grp_attr
PClass  : Group
Visible : 1
EnableC : 1
Style   : 0
TypStyle:=20
ExStyle : 0
TabOrder : 3
Local : 1

#Proc: onClick
procedure bttn_Remove_onClick (integer self, integer event, sequence =
params)--params is ()
	junk =3D getIndex( list_cardattr )
	removeAttr( junk[1] )
end procedure
setHandler( bttn_Remove, w32HClick, routine_id("bttn_Remove_onClick"))
#EndProc


------=_NextPart_000_012B_01C2F39A.07EB9CF0--

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu