From: <cod...@go...> - 2008-09-22 20:55:59
|
Author: M0...@gm... Date: Mon Sep 22 13:55:42 2008 New Revision: 173 Modified: branches/iVL/FrmNetConf.class branches/iVL/FrmNetConf.form branches/iVL/MdlNetConf.module Log: - Added manual DNS configuration options - Added code to handle the resizing of the netconf window OBjects now resize and move according to the window size. Modified: branches/iVL/FrmNetConf.class ============================================================================== --- branches/iVL/FrmNetConf.class (original) +++ branches/iVL/FrmNetConf.class Mon Sep 22 13:55:42 2008 @@ -39,13 +39,43 @@ ME.txtHostName.text = ME.GET_CURRENT_HOST_NAME() MdlNetConf.LIST_NETWORK_INTERFACES + cbUseManDNS.Value = FALSE + tlBanner.text = "<h2>" & tlBanner.text & "</h2>" IF ERROR THEN Message(Error.text & "\n" & Error.where) - + END PUBLIC SUB Form_Menu() MdlNetConf.WRITE_INET() + +END + +PUBLIC SUB Form_Resize() +DIM itxtboxleft AS Integer + + WITH ME + .tlBanner.Move(8, 10, MdlObjSizer.get_object_width(.tlBanner.text)) + .tlHostNameLbl.Move(.tlBanner.Left, .tlBanner.top + .tlBanner.Height + 8, MdlObjSizer.get_object_width(.tlHostNameLbl.text), 21) + .txtHostName.Move(.tlHostNameLbl.left + .tlHostNameLbl.Width + 4, .tlHostNameLbl.top) + .cbUseManDNS.Move(.tlHostNameLbl.Left, .tlHostNameLbl.top + .tlHostNameLbl.Height + 10, MdlObjSizer.get_object_width(.cbUseManDNS.text) + 24) + .tlPrimaryDNS.Move(.cbUseManDNS.left, .cbUseManDNS.top + .cbUseManDNS.Height + 4, MdlObjSizer.get_object_width(.tlPrimaryDNS.text)) + itxtboxleft = .tlPrimaryDNS.Left + .tlPrimaryDNS.Width + 24 + .txtPrimaryDNS.Move(itxtboxleft, .tlPrimaryDNS.Top) + .tlSecDNS.Move(.tlPrimaryDNS.Left, .tlPrimaryDNS.top + .tlPrimaryDNS.Height + 4, MdlObjSizer.get_object_width(.tlSecDNS.text)) + .txtSecDNS.Move(itxtboxleft, .tlSecDNS.top) + ' now move the frame + .frmNetDevices.Move(.tlSecDNS.Left, .tlSecDNS.top + .tlSecDNS.Height + 8) + .frmNetDevices.Width = .ClientWidth - (.frmNetDevices.Left * 2) + .TSNetDevices.Width = .ClientWidth - (.frmNetDevices.left * 5) + + END WITH +END + +PUBLIC SUB cbUseManDNS_Click() + + ME.txtPrimaryDNS.Enabled = cbUseManDNS.Value + ME.txtSecDNS.Enabled = cbUseManDNS.Value END Modified: branches/iVL/FrmNetConf.form ============================================================================== --- branches/iVL/FrmNetConf.form (original) +++ branches/iVL/FrmNetConf.form Mon Sep 22 13:55:42 2008 @@ -1,18 +1,19 @@ # Gambas Form File 2.0 { Form Form - MoveScaled(0,0,94,61) + MoveScaled(0,0,94,74) Text = ("") { tlHostNameLbl TextLabel - MoveScaled(1,2,16,3) + MoveScaled(1,8,16,3) Text = ("Computer Name") + Alignment = Align.Normal } { txtHostName TextBox - MoveScaled(18,2,28,3) + MoveScaled(18,8,28,3) Text = ("") } { frmNetDevices Frame - MoveScaled(1,7,85,49) + MoveScaled(1,23,85,49) Text = (" Network Interfaces") { TSNetDevices TabStrip MoveScaled(2,4,81,43) @@ -20,5 +21,36 @@ Text = ("Tab 0") Index = 0 } + } + { cbUseManDNS CheckBox + MoveScaled(1,12,39,3) + Text = ("Manual DNS Server Specification") + } + { tlPrimaryDNS TextLabel + MoveScaled(2,16,20,3) + Text = ("Primary DNS Server") + Alignment = Align.Normal + } + { txtPrimaryDNS TextBox txtManDNSBoxes + Name = "txtPrimaryDNS" + MoveScaled(24,16,18.5714,3) + Enabled = False + Text = ("192.168.1.254") + } + { tlSecDNS TextLabel + MoveScaled(2,19,21,3) + Text = ("Secondary DNS Server") + Alignment = Align.Normal + } + { txtSecDNS TextBox txtManDNSBoxes + Name = "txtSecDNS" + MoveScaled(26,19,18.5714,3) + Enabled = False + Text = ("") + } + { tlBanner TextLabel + MoveScaled(1,1,45,6) + Text = ("NETWORK CONFIGURATION") + Alignment = Align.Normal } } Modified: branches/iVL/MdlNetConf.module ============================================================================== --- branches/iVL/MdlNetConf.module (original) +++ branches/iVL/MdlNetConf.module Mon Sep 22 13:55:42 2008 @@ -25,6 +25,7 @@ PUBLIC objtlDetails AS Object[] + PRIVATE pWiredPic AS Picture = picture["images/ethernet.png"] PRIVATE pWirelessPic AS picture = picture["images/wireless.png"] @@ -54,6 +55,7 @@ objtxtNetMasks = NEW Object[] objtxtDNS = NEW Object[] objCheckboxes = NEW Object[] + SHELL "ifconfig -a | grep ^[a-z] | grep -v ^lo" TO seths @@ -133,7 +135,7 @@ bCb = NEW CheckBox(FrmNetConf.TSNetDevices) AS "bEnableInterface" ' enable/disable interface box WITH bCb .Move(4, tb.top + tb.Height + 4) - .text = "Enabled" + .text = "Automatically activate this interface at start-up" .Value = TRUE .Height = 21 .Width = MdlObjSizer.get_object_width(.text) + 36 @@ -141,11 +143,8 @@ y = .top + .Height + 8 objCheckboxes.Add(bCb) END WITH - - - - - + ' Split the design here for wireless and wired devices + 'IF sType = "Wireless" THEN tl = NEW TextLabel(FrmNetConf.TSNetDevices) AS "ConfModeLbl" WITH tl .Move(4, y) @@ -171,7 +170,17 @@ y = cb.top + cb.Height + 4 itop = y objCombos.Add(cb) - + ' ' ELSE + ' tl = NEW TextLabel(FrmNetConf.TSNetDevices) AS "tlWirelessSecType" + ' WITH tl + ' .Move(4, y) + ' .text = "Security Mode" + ' .Width = MdlObjSizer.get_object_width(.text) + ' .Height = 21 + ' .Alignment = Align.Normal + ' END WITH + ' END IF + END WITH @@ -186,8 +195,9 @@ DIM frmDetails AS Frame DIM txtbox AS TextBox + DIM cb AS CheckBox DIM tl AS TextLabel - DIM itxtleft, itxtwidth AS Integer + DIM itxtleft, itxtwidth, imandnsleft, imandnstxtleft AS Integer IF LAST.text = "STATIC" THEN frmDetails = NEW Frame(FrmNetConf.TSNetDevices) AS "STaticDetails" @@ -220,6 +230,10 @@ END WITH itxtleft = (tl.Left + tl.Width) * 2 'txtbox.Left itxtwidth = txtbox.Width + imandnsleft = itxtleft + itxtwidth + 8 + + + tl = NEW TextLabel(frmDetails) AS "tlStaticLabels" WITH tl .text = "Subnet Mask" @@ -238,6 +252,8 @@ .MaxLength = 16 IF objtxtNetMasks.Find(txtbox) = -1 THEN objtxtNetMasks.Add(txtbox) ' add to the array END WITH + + tl = NEW TextLabel(frmDetails) AS "tlStaticLabels" WITH tl .Move(8, txtbox.top + txtbox.Height + 4) @@ -256,7 +272,7 @@ .text = "192.168.1.254" IF objtxtDNS.Find(txtbox) = -1 THEN objtxtDNS.Add(txtbox) ' add to the array END WITH - + FOR EACH tl IN objtlDetails IF tl.tag = LAST.tag THEN @@ -295,16 +311,21 @@ PUBLIC SUB bEnableInterface_click() - DIM fFrm AS Frame - DIM Comb AS ComboBox - FOR EACH fFrm IN objFrames - IF fFrm.tag = LAST.tag THEN fFrm.Enabled = LAST.Value - NEXT - FOR EACH Comb IN objCombos - IF Comb.tag = LAST.tag THEN Comb.Enabled = LAST.Value - NEXT + ' ' DIM fFrm AS Frame + ' ' DIM Comb AS ComboBox + ' ' FOR EACH fFrm IN objFrames + ' ' IF fFrm.tag = LAST.tag THEN fFrm.Enabled = LAST.Value + ' ' NEXT + ' ' FOR EACH Comb IN objCombos + ' ' IF Comb.tag = LAST.tag THEN Comb.Enabled = LAST.Value + ' ' NEXT + '''''' ******* Instead of that ^, this will only determing if the inet script will be set executable or not END + + + + PUBLIC SUB WRITE_INET() DIM sScript AS String @@ -314,6 +335,7 @@ DIM txt AS TextBox DIM combo AS ComboBox DIM cb AS CheckBox + DIM ii AS Integer = 0 ' Base the function on the objects rather than the tabstrip |