1. xControls Questions
- Posted by "C. K. Lester" <cklester at yahoo.com> Mar 26, 2003
- 313 views
This is a multi-part message in MIME format. ------=_NextPart_000_00F6_01C2F392.6E1B4190 charset="iso-8859-1" I'm trying to control the size and position of a group and its elements. = For instance, I have a list control and two buttons inside of a group. I = have gotten the group widget to size when the window is resized, but I = can't figure out how to keep the list control and buttons relatively = positioned. Can somebody provide code for that, or is there a hint/trick = to it? __Group_______ | _________ | | |List | | | | | | | | | | | | | | | | | | | | | | | --------- | | Btn1 Btn2 | -------------- Of course, that's all within a window... Thanks, ck ------=_NextPart_000_00F6_01C2F392.6E1B4190 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META http-equiv=3DContent-Type content=3D"text/html; = charset=3Diso-8859-1"> <META content=3D"MSHTML 5.50.4923.2500" name=3DGENERATOR> <STYLE></STYLE> </HEAD> <BODY> <DIV><FONT face=3D"Courier New" size=3D2>I'm trying to control the size = and position=20 of a group and its elements. For instance, I have a list control and two = buttons=20 inside of a group. I have gotten the group widget to size when the = window is=20 resized, but I can't figure out how to keep the list control and buttons = relatively positioned. Can somebody provide code for that, or is there a = hint/trick to it?</FONT></DIV> <DIV><FONT face=3D"Courier New" size=3D2></FONT> </DIV> <DIV><FONT face=3D"Courier New" size=3D2>__Group_______</FONT></DIV> <DIV><FONT face=3D"Courier New" = size=3D2>| _________ |</FONT></DIV> <DIV><FONT face=3D"Courier New" size=3D2>| |List =20 | |</FONT></DIV> <DIV><FONT face=3D"Courier New" size=3D2> <DIV><FONT face=3D"Courier New"=20 size=3D2>| | =20 | |</FONT></DIV></FONT></DIV> <DIV><FONT face=3D"Courier New" size=3D2> <DIV><FONT face=3D"Courier New"=20 size=3D2>| | = | |</FONT></DIV> <DIV><FONT face=3D"Courier New"=20 size=3D2>| | = | |</FONT></DIV> <DIV><FONT face=3D"Courier New"=20 size=3D2>| | = | |</FONT></DIV> <DIV><FONT face=3D"Courier New"=20 size=3D2>| | =20 | |</FONT></DIV>| --------- |</FONT></DIV> <DIV><FONT face=3D"Courier New"=20 size=3D2>| Btn1 Btn2 |</FONT></DIV> <DIV><FONT face=3D"Courier New" size=3D2>--------------</FONT></DIV> <DIV><FONT face=3D"Courier New" size=3D2></FONT> </DIV> <DIV><FONT face=3D"Courier New" size=3D2>Of course, that's all within a=20 window...</FONT></DIV> <DIV><FONT face=3D"Courier New" size=3D2></FONT> </DIV> <DIV><FONT face=3D"Courier New" size=3D2>Thanks,</FONT></DIV> <DIV><FONT face=3D"Courier New" size=3D2>ck</FONT></DIV> <DIV><FONT face=3D"Courier New" = ------=_NextPart_000_00F6_01C2F392.6E1B4190--
2. Re: xControls Questions
- Posted by "C. K. Lester" <cklester at yahoo.com> Mar 26, 2003
- 317 views
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--
3. Re: xControls Questions
- Posted by Derek Parnell <ddparnell at bigpond.com> Mar 26, 2003
- 322 views
----- Original Message ----- >From: "C. K. Lester" <cklester at yahoo.com> >To: "EUforum" <EUforum at topica.com> >Subject: xControls Questions > > >I'm trying to control the size and position of a >group and its elements. For instance, I have a list >control and two buttons inside of a group. I have >gotten the group widget to size when the window is >resized, but I can't figure out how to keep the >list control and buttons relatively positioned. >Can somebody provide code for that, or is there >a hint/trick to it? > >__Group_______ >| _________ | >| |List | | >| | | | >| | | | >| | | | >| | | | >| | | | >| --------- | >| Btn1 Btn2 | >-------------- I do this sort of thing all the time. The first step is to write down what are the relationships you want to preserve. For this example, I'll guess the following... The top edge of List is always x1 pixels from the top edge of Group. The left edge of List is always x2 pixels from the left edge of Group. The right edge of List is always -x3 pixels from the right edge of Group. The bottom edge of List is always -x4 pixels from the top edge of Btn1. The left edge of Btn1 is always the same as List. The width of Btn1 is always x5 pixels. The height of Btn1 is always x6 pixels. The right edge of Btn2 is always the same as the right edge of List. The top of Btn2 is always the same as the top of Btn1. The width of Btn2 is always x7 pixels. The height of Btn2 is always x6 pixels. The bottom of Btn1 is always -x8 pixels from the bottom edge of Group. Now order these rules based on their dependancies. In this case, apply the rules that related to the Group edges first. The top edge of List is always x1 pixels from the top edge of Group. The left edge of List is always x2 pixels from the left edge of Group. The right edge of List is always -x3 pixels from the right edge of Group. The bottom of Btn1 is always -x8 pixels from the bottom edge of Group. Now that these have been 'fixed', apply the next rules related to the fixed edges. The left edge of Btn1 is always the same as List. The right edge of Btn2 is always the same as the right edge of List. The top of Btn2 is always the same as the top of Btn1. The width of Btn2 is always x7 pixels. The height of Btn2 is always x6 pixels. The width of Btn1 is always x5 pixels. The height of Btn1 is always x6 pixels. Finally, apply the remaining rule. The bottom edge of List is always -x4 pixels from the top edge of Btn1. Hope this helps. ---------------- cheers, Derek Parnell
4. Re: xControls Questions
- Posted by "C. K. Lester" <cklester at yahoo.com> Mar 26, 2003
- 328 views
Derek, thanks so much for the great help... One question: > Now order these rules based on their dependancies. In this case, apply the > rules that related to the Group edges first. > > The top edge of List is always x1 pixels from the top edge of Group. > The left edge of List is always x2 pixels from the left edge of Group. > The right edge of List is always -x3 pixels from the right edge of Group. > The bottom of Btn1 is always -x8 pixels from the bottom edge of Group. Btn1 will later reference the List... how do I only set the Btn1 bottom at this point?