Results 1 to 2 of 2

Thread: crash with dxut gui

  1. #1

    crash with dxut gui

    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

    Code:
                  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;
    Code:
                  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

    Code:
                  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?

  2. #2

    crash with dxut gui

    Why are you not using "AddComboBox"?
    Theoretically, just by exploring source code and waching for differences your implementation of "AddComboBox" lacks "Result := InitControl(pControl);"
    There are only 10 types of people in this world; those who understand binary and those who don't.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •