[Gambas-user] My first attempt at making a control - some questions

Benoît Minisini gambas at ...1...
Thu Mar 11 13:58:20 CET 2010


> I  decided tonight to make a little control - something simple, a vbox,
> containing a picturebox, underneath that a hbox with label, textbox and
> checkbox.
> 
> I've read the doc's on the website and have had a modicum of success in
> that I've. I wanted a compound control because I'm writing a section in my
> program where I allocate scanned documents to a patients file, and wanted
> to be able to join multiple pages sometimes into a single pdf file.
> 
> I needed to be able to display the thumbs of the first page of the pdf, 4-6
> to a page, and under each picture, needed the textbox.
> 
> So far so good, my control sort-of works. I enclose the code for anyone who
> knows about this to comment on, but I've a couple of questions.:
> 
> 
> 
> When I compiled it to an exe > saved it to
> 
> /home/richard/pdfpreview as pdfpreview.gambas.
> 

You should keep the executable inside the project directory.

> It was then available as a component to the project I wrote it in as a
> control (without an icon).
> 
> The docs say that for gamabs3 - you need a .hidden/control directory, and
> to put the icon in there with the same name as the control. eg
> pdfpreview.png, I did this and the icon is under the sources dir. This
> dosn't appear in the toolbox. However if you re-compile the control it
> does - maybe common sense, but should be mentioned in the docs.

Indeed.

> 
> I don't understand this:
> "You can install the component in your home directory by checking the
> corresponding option in the "Make executable" dialog.
> Once installed there, the component will be visible in the "Components" tab
> of the project property dialog as any other globally installed components.
> To uninstall the component from your home directory, just uncheck the
> option in the "Make executable" dialog, and make the executable again. "
> 
> Why the 'home directory', does this mean just /richard/home, if so why
> there? 

It just means that a symbolic link pointed at the executable (and other 
symbolic links) will be created somewhere in the ~/.local directory.

> It is stated that this:
> PUBLIC CONST _DrawWith AS String = "TextBox"
> 
> will cause the control to be used to draw with in the ide. 
> ?what does one
> replace the "textbox" with , the name of your control?
> 
> Also I did do the above, and nothing happens, still uses the drawing area.

I'm afraid that this feature is not used anymore by the IDE. I have removed it 
recently.

> Also I wanted a double click event on the picturebox, there is an example
> of a click event which i've used, but couldn't figure out the double
> click. 

_DblClick ?

> Lastly, as the control is in /home/richard/pdfpreview, but appears
> in my project which is an svn project living in another directory, what
> happens if someone else checks out the svn - how to they get hold of the
> control?

That is the problem. The current implementation of user control coming from 
Gambas 2 does not satisfy me at all, and I think I will redesign it completely 
soon.

I think that what is needed is sharing code between projects, one (or more) 
being "main" projects, the others acting like components. 

So I'm currently thinking adding a "user component directory" option in each 
project: all Gambas projects inside this directory will be taken as user 
components when running the main project from the IDE.

At runtime, it must be different, the "user component directory" having no 
sense anymore. And only the executable is needed. 

Maybe I could introduce the concept of "user component group" attached to a 
project, which is just the name of a subdirectory where all the user 
components of the projects will be searched. I don't know yet exactly...

Regards,

-- 
Benoît Minisini




More information about the User mailing list