Author Topic: wxSmith dataobjects for controls  (Read 4140 times)

Offline frithjofh

  • Regular
  • ***
  • Posts: 376
wxSmith dataobjects for controls
« on: June 20, 2007, 10:03:42 am »
Hi everyone,

dont blame me if my question is stupid, i looked around a bit and searched, but i didnt get any further:

is there a posibility to use a, lets say textcontrol in wxSmith and  give it a wxArrayString with the initial text values instead of adding all the items in that list accesible through the properties-dialog...? this would be so much more comfortable.

There is this option "additional code" at the bottom of properties, but is it that what i have to use? Or anyway, whats it for??

Great app and great plugins, many thanks to all the family

frithjofh
architect with some spare time  -  c::b compiled from last svn  -   openSuSE leap x86_64  -  AMD FX-4100

Offline byo

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 837
Re: wxSmith dataobjects for controls
« Reply #1 on: June 20, 2007, 10:34:55 am »
is there a posibility to use a, lets say textcontrol in wxSmith and  give it a wxArrayString with the initial text values instead of adding all the items in that list accesible through the properties-dialog...? this would be so much more comfortable.

Hmm, for text control it will be hard to do, for lists (like wxListBox) you can call ListBoxName->Append(ArrayOfStrings);. For more informations on items with sime string lists I suggest this page.

Quote
There is this option "additional code" at the bottom of properties, but is it that what i have to use? Or anyway, whats it for??

This property give you ability to add extra initialization code BEFORE processing next item in window. Usually this property won't be necessary because you can add such code directly inside constructor (right after //*) comment which marks the end of auto-generated code). But if it can not be done this way (f.ex. some extra things must be done before code starts to initialize next item in window) you can add some stuff into "additional code" and it will be put directly into automatically generated one.

It was added some time ago to allow adding icons into menus. But since menus have icon property, I don't know about any "requirement" of this property so probably you don't need it either ;)


Regards
  BYO

Offline frithjofh

  • Regular
  • ***
  • Posts: 376
Re: wxSmith dataobjects for controls
« Reply #2 on: June 20, 2007, 11:21:18 am »
hi, thanks for the fast answer,

can i put the line   anylistcontrol->add(wxArrayString)    (... i allready looked on the wxwidgets page... ) some where through wxSmith...?

i meen right through the properties settings of the listcontrol...?

i know that i can add this manually, but that was not my point  :)

greetings from asturias

frithjofh
architect with some spare time  -  c::b compiled from last svn  -   openSuSE leap x86_64  -  AMD FX-4100

Offline byo

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 837
Re: wxSmith dataobjects for controls
« Reply #3 on: June 20, 2007, 04:21:06 pm »
can i put the line   anylistcontrol->add(wxArrayString)    (... i allready looked on the wxwidgets page... ) some where through wxSmith...?

What do you mean exactly ? Could you give me some example ?

BYO

Offline frithjofh

  • Regular
  • ***
  • Posts: 376
Re: wxSmith dataobjects for controls
« Reply #4 on: June 20, 2007, 06:11:13 pm »
hi, sorry for the lacking precision...

i meen this: i have a wxChoice object and as it inherits wxControlWithItems it should have the method:

wxControlWithItems::Append

int Append(const wxString& item)
Adds the item to the end of the list box.

int Append(const wxString& item, void *clientData)

int Append(const wxString& item, wxClientData *clientData)

Adds the item to the end of the list box, associating the given, typed or untyped, client data pointer with the item.

void Append(const wxArrayString& strings)

Appends several items at once to the control. Notice that calling this method may be much faster than appending the items one by one if you need to add a lot of items.

Parameters

item

            String to add.

clientData

            Client data to associate with the item.

Return value

When appending a single item, the return value is the index of the newly added item which may be different from the last one if the control is sorted (e.g. has wxLB_SORT or wxCB_SORT style).


it is especialy the form     void Append(const wxArrayString& strings)    that interests me. how do i append a wxArrayString to a wxChoice using wxSmith interface, that is the properties dialog?

hope my question isnt too stupid, i only began with wxWidgets about three months ago, and as a programmer im absolute autodidact...

greetings

frithjofh
architect with some spare time  -  c::b compiled from last svn  -   openSuSE leap x86_64  -  AMD FX-4100

Offline byo

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 837
Re: wxSmith dataobjects for controls
« Reply #5 on: June 20, 2007, 07:06:53 pm »
Ok, I hope I've understood you well :).
I quess that you prepare some wxArrayString before window is being created and than want to add it to wxChoice. As long as this list is static (it's always the same no matter what), there's no use adding it through array and you may specify all inside wxSmith.

If the sting list is dynamic (it changes during program execution), you have to add it manually, either by adding your own code into constructor or by using the "additional code" property (just put ChoiceVariable->Append(YourArray); there). If you additionally want the wxChoice to dynamically change it's content while window is shown, this also has to be handled manually.

Hope that now it's clear :)

Regards
  BYO

Offline frithjofh

  • Regular
  • ***
  • Posts: 376
Re: wxSmith dataobjects for controls
« Reply #6 on: June 20, 2007, 07:18:20 pm »
many thanks, that was exactly the information i needed, indeed i have some content for the wxChoice which must be able to change dynamically...

thanks a lot...

i think tomorrow ill bug you with something else, but i can imagen, and this evening i will harness and find out about something similar:

those validator-objects which can go into some constructors, as wxTextCtrl... having read what you posted i think this will do also or manually or by the aditional code line...

regards and thanks  :D

frithjofh
architect with some spare time  -  c::b compiled from last svn  -   openSuSE leap x86_64  -  AMD FX-4100