New topic: 

Container Control (navigation buttons) example code please

<http://forums.realsoftware.com/viewtopic.php?t=47718>

         Page 1 of 1
   [ 7 posts ]                 Previous topic | Next topic          Author  
Message        superjacent          Post subject: Container Control (navigation 
buttons) example code pleasePosted: Sat Apr 27, 2013 6:36 am                    
             
Joined: Sat Oct 01, 2005 4:47 am
Posts: 107
Location: Melbourne, Australia                Okay, I've just come across 
Container Controls and would appreciate some guidance with coding. I've created 
the Container Control and have got four Push Buttons (a control array) relating 
to database navigation (First, Previous, Next & Last).

On placing the Container Control on a Window I'm not able to enter my 
navigation code. At the design level of the Container Control I'm not able to 
enter my class navigation method, so it is present when placing the Container 
Control onto a Window (obviously not in scope).

I'm assuming this is doable and would appreciate some tips, hints or further 
explanations regarding this. I perused the LR but it didn't go into coding 
examples.      
_________________
Steve
rs2012 r2.1 Windows 7.  
                             Top                simulanics          Post 
subject: Re: Container Control (navigation buttons) example code pleaPosted: 
Sat Apr 27, 2013 7:44 pm                                 
Joined: Sun Aug 12, 2007 10:10 am
Posts: 1067
Location: Boiling Springs, SC                Place the code in the button 
events of the container control. Once the container is on a window, it acts a a 
single control (although you can still call container.pushbutton.caption etc). 
Have the buttons raise events that you define in the container...from the 
window, these events will be visible/usable. If you would like a demonstration, 
I'd be glad to compose one for you.      
_________________
Matthew A. Combatti
Real Studio 2012 r1.2
Visit Xojo Developer's Spot!
Systems I Use:
Windows XP/Windows Vista/Windows Server 2008 r2/Windows 7/Windows 8
Mac OSX 10.5/Mac OSX 10.6/Mac OSX Server/Ubuntu/Debian/Suse/Red Hat/
Windows Server 2011/CentOS 5.4 /ReactOS/SimOS
~All Xojo Compatible~  
                             Top                superjacent          Post 
subject: Re: Container Control (navigation buttons) example code pleaPosted: 
Sat Apr 27, 2013 8:08 pm                                 
Joined: Sat Oct 01, 2005 4:47 am
Posts: 107
Location: Melbourne, Australia                simulanics wrote:...snip...
If you would like a demonstration, I'd be glad to compose one for you.

Thanks simulanics, would appreciate it.

I've semi-sort of got it working now wherein I've placed code in the design of 
the button on the container control where a simple msgbox displays the relevant 
button clicked (0,1,2 or 3). Then placing that container control on a window, 
it works, click a button and the index value of the button is displayed (no 
additional code written on the Window to achieve this).

Where I'm having some difficulty is writing code that refers to a class method 
(myclass.NavigateRecord(intDirection) ). This class is instantiated from the 
Window.      
_________________
Steve
rs2012 r2.1 Windows 7.  
                             Top                Karen          Post subject: 
Re: Container Control (navigation buttons) example code pleaPosted: Sat Apr 27, 
2013 9:39 pm                         
Joined: Fri Sep 30, 2005 8:53 am
Posts: 995                superjacent wrote:simulanics wrote:...snip...
If you would like a demonstration, I'd be glad to compose one for you.

Thanks simulanics, would appreciate it.

I've semi-sort of got it working now wherein I've placed code in the design of 
the button on the container control where a simple msgbox displays the relevant 
button clicked (0,1,2 or 3). Then placing that container control on a window, 
it works, click a button and the index value of the button is displayed (no 
additional code written on the Window to achieve this).

Where I'm having some difficulty is writing code that refers to a class method 
(myclass.NavigateRecord(intDirection) ). This class is instantiated from the 
Window.

You are missing the point I think. If you want to make the containerControl 
useable you need to create new events on the Containercontrol and call them 
from the buttons. 

If you want to use a controlArray then you only need one Event on the 
container. That event could be

Event ButtonPressed(index as Integer)

And in the button Action event put
RaiseEvent ButtonPushed(index)


When you put teh container control on a Window, then put your code in the 
ContainerControl ButtonPushed event

I think I might not use a Button ControlArray, but just 4 separate buttons with 
4 separate events as it would make the code more readable.


- Karen   
                             Top                superjacent          Post 
subject: Re: Container Control (navigation buttons) example code pleaPosted: 
Sat Apr 27, 2013 11:19 pm                                 
Joined: Sat Oct 01, 2005 4:47 am
Posts: 107
Location: Melbourne, Australia                karen wrote:You are missing the 
point I think. If you want to make the containerControl useable you need to 
create new events on the Containercontrol and call them from the buttons. 

If you want to use a controlArray then you only need one Event on the 
container. That event could be

Event ButtonPressed(index as Integer)

And in the button Action event put
RaiseEvent ButtonPushed(index)


When you put teh container control on a Window, then put your code in the 
ContainerControl ButtonPushed event

Thanks Karen, yes I was stumped. I haven't come across the 'RaiseEvent' method 
before hence my basic questions regarding this. Anyway, got it working. Thanks 
everyone.

karen wrote:I think I might not use a Button ControlArray, but just 4 separate 
buttons with 4 separate events as it would make the code more readable.
I hear what you say but I'm comfortable with this style.  Thinking aloud, 
knowing what I know now,  I could extend this ContainerControl Navigation 
module to also include a text box which displays the record number/total ( eg. 
5 of 25) with the ability to directly enter a number for go to purposes. 
Similar to Access record counter navigator (forgotten what it's called in 
Access).      
_________________
Steve
rs2012 r2.1 Windows 7.  
                             Top                simulanics          Post 
subject: Re: Container Control (navigation buttons) example code pleaPosted: 
Sun Apr 28, 2013 12:03 am                                 
Joined: Sun Aug 12, 2007 10:10 am
Posts: 1067
Location: Boiling Springs, SC                To use a class from the container 
without lots of code...in the container add a property "as classname" and let 
it be public... Then from window1, set container.definedproperyclass = 
theclasscreatedinwindow1. Then you can simply call the property(class) from 
with the container buttons and it's accessible globally throughout the 
container control or from your window by calling 
container.definedpropery.functionname(parameters) etc.

I used a similar method to write SimScript Plugins for REALbasic 

http://www.xojodevspot.com/SimPlugins.rar

(basically extents rbscripts to access objects, methods, and properties outside 
defined RBScript contexts...to create controls dynamically and exchange data 
seamlessly without having to write dlls or dylibs etc and to expand upon your 
apps, rather than issue an 'upgrade'..simply issue small plugins or have them 
auto downloaded. Best yet, they're plain text (encrypted in the full version to 
prevent people from altering your distributed plugins:-)) The download is a 
demo version of the simscript classes/containers... I was fascinated with 
Einhuger's Lua plugin..but highly against external functionality if it can 
remain internal (rbx plugins break with new releases..ie Xojo)..thus, I 
re-wrote Lua in REALbasic, gave it a JavaScript/Basic/PHP twist (took the 
efficient parts of each language and married them together ), and gave access 
to hook into application internals.

Definately get a good grasp on container controls and the canvas control..they 
help in the creation of custom designed controls greatly... If you still need 
help feel free to ask.      
_________________
Matthew A. Combatti
Real Studio 2012 r1.2
Visit Xojo Developer's Spot!
Systems I Use:
Windows XP/Windows Vista/Windows Server 2008 r2/Windows 7/Windows 8
Mac OSX 10.5/Mac OSX 10.6/Mac OSX Server/Ubuntu/Debian/Suse/Red Hat/
Windows Server 2011/CentOS 5.4 /ReactOS/SimOS
~All Xojo Compatible~  
                             Top                superjacent          Post 
subject: Re: Container Control (navigation buttons) example code pleaPosted: 
Sun Apr 28, 2013 1:22 am                                 
Joined: Sat Oct 01, 2005 4:47 am
Posts: 107
Location: Melbourne, Australia                Thanks simulanics, appreciate 
your help.  I've downloaded the file and will have a good snoop around.      
_________________
Steve
rs2012 r2.1 Windows 7.  
                             Top             Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 7 posts ]      
-- 
Over 1500 classes with 29000 functions in one REALbasic plug-in collection. 
The Monkeybread Software Realbasic Plugin v9.3. 
http://www.monkeybreadsoftware.de/realbasic/plugins.shtml

[email protected]

Reply via email to