[Gambas-user] Component Programing Question

B Bruen bbruen at ...2308...
Wed Jun 4 01:48:51 CEST 2014


On Tue, 3 Jun 2014 07:02:44 -0700 (PDT)
VonZorch <VonZorch at ...626...> wrote:

> B Bruen wrote
> > On Mon, 02 Jun 2014 03:27:23 +0200
> > Benoît Minisini <
> 
> > gambas at ...3286...
> 
> > > wrote:
> > 
> >> Le 02/06/2014 03:07, VonZorch a écrit :
> >> > I have found that inheriting UserControl makes a developing control
> >> stop
> >> > intercepting mouse events.  Is this normal? I have been going around in
> >> > circles trying to get my SpeedListBox working.
> >> >
> >> > It currently appears in the toolbox but when placed on a form it is 8
> >> times
> >> > as large as it should be and when I try to run the test project I get
> >> an
> >> > error "Unexpected end of line in FMain.form:17" however the FMain.form
> >> file
> >> > only has 13 lines.  When created in code it does work correctly.  Could
> >> this
> >> > be caused by a corrupted component?
> >> >
> >> 
> >> Without seeing your source code, I can't say anything useful...
> >> 
> >> -- 
> >> Benoît Minisini
> >> 
> > 
> > But to take a couple of guesses:
> > In the second paragraph, what you have written suggests that you have not
> > set the default values for the properties and/or the properties constant
> > correctly. 
> > "8 times too big" looks like something wrong with your _DefaultSize
> > constant. Remember, it is expressed in Desktop.Scale units.
> > "caused by a corrupted component?" Probably not, more likely you have not
> > defined the control infrastructure constants correctly. Show us the code.
> > 
> > In the first para "Is this normal"? No, I have not seen anything like
> > that. Again, SUTC!
> > 
> > hth
> 
> The code is here  speedlistbox.gz
> <http://gambas.8142.n7.nabble.com/file/n46832/speedlistbox.gz>  .
> The mouse event problem also occurred when I modified ColorChooser to save
> custom colors.
> 
> 
1. Change 
  Public Const _DefaultSize As String = "400,24"
to 
  Public Const _DefaultSize As String = "50,4"
This may give you some idea of what I meant by Desktop.Scale units

2. This may help you understand some things. In your _Properties const you have 'Maxlines=20". Now, all this does is set the default value that the IDE uses when it displays that property in the control's property list. It does not set the value of the real property to that value. In fact it assumes that you have set it to that value elsewhere in the code AND if the coder does not change that property value in the IDE then the .form file will not contain a setting for that property. So somewhere, possibly in your _new routine you need to set Maxlines (or the underlying real property) to 20 as well as setting that default value in the _Properties const string.  Review your code for other places where this may be needed.

3. I'm still not actually sure about the loss of mouse events, but it may be beneficial for you to review the help on the custom control "Proxy" setting.

hth
Bruce
-- 
B Bruen <bbruen at ...2308...>




More information about the User mailing list