tux
17-03-2005, 09:07 PM
im working on my menu builder and ive stumbled across a problem, everything was working well until i tryed to add a combo box
this is the code to add some controls
Control := CDXUTStatic.Create(Dialog);
(Control as CDXUTStatic).SetLocation(SpinEdit1.Value, SpinEdit2.Value);
(Control as CDXUTStatic).SetSize(SpinEdit3.Value, SpinEdit4.Value);
(Control as CDXUTStatic).Text := StrToPWideChar(Edit1.Text);
(Control as CDXUTStatic).Default := CheckBox1.Checked;
Dialog.AddControl(Control as CDXUTStatic);
strType := 'Label';
Result := True;
Control := CDXUTButton.Create(Dialog);
(Control as CDXUTButton).SetLocation(SpinEdit1.Value, SpinEdit2.Value);
(Control as CDXUTButton).SetSize(SpinEdit3.Value, SpinEdit4.Value);
(Control as CDXUTButton).Text := StrToPWideChar(Edit1.Text);
(Control as CDXUTButton).Default := CheckBox1.Checked;
Dialog.AddControl(Control as CDXUTButton);
strType := 'Button';
Result := True;
(just to give you an example), that code works fine and the control (CDXUTControl) is added to the dialog fine.
however the following code doesnt work
Control := CDXUTComboBox.Create(Dialog);
(Control as CDXUTComboBox).SetLocation(SpinEdit1.Value, SpinEdit2.Value);
(Control as CDXUTComboBox).SetSize(SpinEdit3.Value, SpinEdit4.Value);
(Control as CDXUTComboBox).Default := CheckBox1.Checked;
for iLoop:=0 to Memo1.Lines.Count -1 do
(Control as CDXUTComboBox).AddItem(StrToPWideChar(Memo1.Lines[ iLoop]), nil);
Dialog.AddControl(Control as CDXUTComboBox);
strType := 'Combo Box';
Result := True;
the access violation is in UpdateRects on line pFontNode := DXUTGetGlobalDialogResourceManager.GetFontNode(m_E lements[2].iFont); (in the setlocation)
ive got, labels, buttons, check boxes, radio buttons working fine so far, this is the first one to crash.
any ideas?
this is the code to add some controls
Control := CDXUTStatic.Create(Dialog);
(Control as CDXUTStatic).SetLocation(SpinEdit1.Value, SpinEdit2.Value);
(Control as CDXUTStatic).SetSize(SpinEdit3.Value, SpinEdit4.Value);
(Control as CDXUTStatic).Text := StrToPWideChar(Edit1.Text);
(Control as CDXUTStatic).Default := CheckBox1.Checked;
Dialog.AddControl(Control as CDXUTStatic);
strType := 'Label';
Result := True;
Control := CDXUTButton.Create(Dialog);
(Control as CDXUTButton).SetLocation(SpinEdit1.Value, SpinEdit2.Value);
(Control as CDXUTButton).SetSize(SpinEdit3.Value, SpinEdit4.Value);
(Control as CDXUTButton).Text := StrToPWideChar(Edit1.Text);
(Control as CDXUTButton).Default := CheckBox1.Checked;
Dialog.AddControl(Control as CDXUTButton);
strType := 'Button';
Result := True;
(just to give you an example), that code works fine and the control (CDXUTControl) is added to the dialog fine.
however the following code doesnt work
Control := CDXUTComboBox.Create(Dialog);
(Control as CDXUTComboBox).SetLocation(SpinEdit1.Value, SpinEdit2.Value);
(Control as CDXUTComboBox).SetSize(SpinEdit3.Value, SpinEdit4.Value);
(Control as CDXUTComboBox).Default := CheckBox1.Checked;
for iLoop:=0 to Memo1.Lines.Count -1 do
(Control as CDXUTComboBox).AddItem(StrToPWideChar(Memo1.Lines[ iLoop]), nil);
Dialog.AddControl(Control as CDXUTComboBox);
strType := 'Combo Box';
Result := True;
the access violation is in UpdateRects on line pFontNode := DXUTGetGlobalDialogResourceManager.GetFontNode(m_E lements[2].iFont); (in the setlocation)
ive got, labels, buttons, check boxes, radio buttons working fine so far, this is the first one to crash.
any ideas?