Home > Archive > Programming with dBASE > March 2006 > Maximum number of form components









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Maximum number of form components
Omar Mohammed

2006-03-15, 8:23 pm

Hi.
I am trying to write an app (this is dB2k 0.4 BTW) that would draw
rectangles on a form.
All the rectangles are the same size. Basically a counter starts from 1
and goes to a total.
The problem is when I reach 4095 rectangles I get
"not enough memory for this operation".
The computer is a P4 with 1GB RAM and my memory() at this point says
around 2890000 (it fluctuates around that).
I tried other components (entryfield, text, etc.) and realised that the
number 4095 is constant. Now I believe when trying to create the 4096th
object, it causes this problem. Which means memory allocation is
probably 4096/1024 (4KB) per component? I'm not sure here, just a wild
guess.

Two questions:
1) Is there a way to increase this allocation?
2) Is there a maximum amount of components that can be created on a form?

The application is using a rectangle as a grid on a map. Each rectangle
is coloured differently to represent different objects on the map. It
looks like an Excel spreadsheet with rows and columns, but the rows and
columns are shaded with different colours rather than having words or
numbers in them.
Maybe I'm using the wrong component to do this? If so what would be a
better choice? I'm using the rectangle because it seems to be the
easiest to put a color to.
Any help would be greatly appreciated

I've attached a small turnkey application that could explain my problem.

Thanks

Omar


** END HEADER -- do not remove this line
//
// Generated on 03/15/2006
//
parameter bModal
local f
f = new testrectForm()
if (bModal)
f.mdi = false // ensure not MDI
f.readModal()
else
f.open()
endif

class testrectForm of FORM
with (this)
onOpen = class::FORM_ONOPEN
metric = 5 // Millimeters
height = 34.29
left = 89.535
top = 47.2017
width = 77.0467
text = ""
endwith


function form_onOpen
form.pageno := 2 // to speed up the program not having to redraw
the rectangles
for x = 1 to 5000
? x,memory()
cmd = 'form.rectangle'+x+' = new RECTANGLE(form)';&cmd
cmd = 'form.rectangle'+x+'.left = 1';&cmd
cmd = 'form.rectangle'+x+'.top = 1';&cmd
cmd = 'form.rectangle'+x+'.width = 1';&cmd
cmd = 'form.rectangle'+x+'.height = 1';&cmd
cmd = 'form.rectangle'+x+'.text = ""';&cmd
cmd = null
endfor
return
endclass
Robert Bravery

2006-03-15, 8:23 pm

Hi,

Its a windows thing mostly. Windows only allocates a certain amount of
resources for GUI objects, when you reach that youre out of luck
It might also be a windows linit perf windows form, or even a dbase limit.
But the bottom line is there is only a certain amount of stuff you can put
on a form.
Why would one want 4096 objects on a form anyway. bad programming should not
be done

Robert

"Omar Mohammed" <omarATprogmatix.biz> wrote in message
news:yUBu2DISGHA.876@news-server...
> Hi.
> I am trying to write an app (this is dB2k 0.4 BTW) that would draw
> rectangles on a form.
> All the rectangles are the same size. Basically a counter starts from 1
> and goes to a total.
> The problem is when I reach 4095 rectangles I get
> "not enough memory for this operation".
> The computer is a P4 with 1GB RAM and my memory() at this point says
> around 2890000 (it fluctuates around that).
> I tried other components (entryfield, text, etc.) and realised that the
> number 4095 is constant. Now I believe when trying to create the 4096th
> object, it causes this problem. Which means memory allocation is
> probably 4096/1024 (4KB) per component? I'm not sure here, just a wild
> guess.
>
> Two questions:
> 1) Is there a way to increase this allocation?
> 2) Is there a maximum amount of components that can be created on a form?
>
> The application is using a rectangle as a grid on a map. Each rectangle
> is coloured differently to represent different objects on the map. It
> looks like an Excel spreadsheet with rows and columns, but the rows and
> columns are shaded with different colours rather than having words or
> numbers in them.
> Maybe I'm using the wrong component to do this? If so what would be a
> better choice? I'm using the rectangle because it seems to be the
> easiest to put a color to.
> Any help would be greatly appreciated
>
> I've attached a small turnkey application that could explain my problem.
>
> Thanks
>
> Omar
>
>
> ** END HEADER -- do not remove this line
> //
> // Generated on 03/15/2006
> //
> parameter bModal
> local f
> f = new testrectForm()
> if (bModal)
> f.mdi = false // ensure not MDI
> f.readModal()
> else
> f.open()
> endif
>
> class testrectForm of FORM
> with (this)
> onOpen = class::FORM_ONOPEN
> metric = 5 // Millimeters
> height = 34.29
> left = 89.535
> top = 47.2017
> width = 77.0467
> text = ""
> endwith
>
>
> function form_onOpen
> form.pageno := 2 // to speed up the program not having to redraw
> the rectangles
> for x = 1 to 5000
> ? x,memory()
> cmd = 'form.rectangle'+x+' = new RECTANGLE(form)';&cmd
> cmd = 'form.rectangle'+x+'.left = 1';&cmd
> cmd = 'form.rectangle'+x+'.top = 1';&cmd
> cmd = 'form.rectangle'+x+'.width = 1';&cmd
> cmd = 'form.rectangle'+x+'.height = 1';&cmd
> cmd = 'form.rectangle'+x+'.text = ""';&cmd
> cmd = null
> endfor
> return
> endclass



Rich Assaf

2006-03-15, 8:23 pm

"Omar Mohammed" <omarATprogmatix.biz> wrote in message
news:yUBu2DISGHA.876@news-server...

> Maybe I'm using the wrong component to do this? If so what would be a
> better choice? I'm using the rectangle because it seems to be the easiest
> to put a color to.



I remember from ancient history that Romain Strieff had used a paintbox
control for something similar - maybe for seats in a concert hall (and I
know for sure he had one representing teeth for dental exam). As I recall,
one rationale was that fewer resources would be used..... Perhaps you could
investigate this option.

Rich Assaf


Omar Mohammed

2006-03-16, 7:27 am

>>Why would one want 4096 objects on a form anyway. bad programming[color=da
rkred]


I agree with you totally.
However, in this case I really can't find a better option.
The application tracks stock items within a warehouse. There are several
warehouses, each with a different layout.
When goods are moved from one storage bin to another, it has to be shown
on the virtual map (it's linked to a PDA so when the transfers are made,
the server gets updated automatically). Each lane has a number of bins
and there are a number of lanes. What I want to do is show the warehouse
manager at a glance where his stock is. Obviously there are more than
4096 stock items (there's actually about 10,000 items per warehouse). So
lane 1 may have 50 sections each with 10 bins and there may be up to 10
lanes. So there's approx. 5000 bins in that warehouse alone. I need to
represent each bin as something (I thought a rectangle would do), so
when the manager clicks, he gets a picture of his warehouse and all the
stock location.
The program is actually complete and it works. I wrote the PDA and the
database application and everything shows up fine on the screen.
However, when I tested I only tested about 2000 bin locations. Didnt
realise about this limitation.

Any suggestions? It's actually as Rich mentioned, very similar to the
program tracking seats in a concert hall done by Romain. However, I
don't think his app. catered for 5000 seats, not too sure. I'm still
looking for it.

Thanks

Omar
Omar Mohammed

2006-03-16, 7:27 am

>>I remember from ancient history that Romain Strieff had used a[color=darkred]
(and >>I[color=darkred]
you >> could[color=darkred]



Rich

Thanks. I tried changing it to a paintbox, but it still stopped at 4096
Anyway I'm looking for the program now. I'm sure Romain's technique
would be far better than mine

Omar
David Stone

2006-03-16, 7:27 am

Omar Mohammed wrote:

> Thanks. I tried changing it to a paintbox, but it still stopped at 4096


The idea would be to use one paintbox and draw rectangles (or whatever
shape you want to represent a bin) in the paintbox.

> Anyway I'm looking for the program now. I'm sure Romain's technique
> would be far better than mine


Just fancier---API and all that. ;-)

David

Here's some Romain code:

erase questions.dbf
if not file("questions.dbf")
create table "questions.dbf" (;
question1 numeric(1,0),;
question2 numeric(1,0),;
question3 numeric(1,0))
insert into "questions.dbf";
(question1,question2
,question3) values;
(1,2,3)
insert into "questions.dbf";
(question1,question2
,question3) values;
(3,2,1)
insert into "questions.dbf";
(question1,question2
,question3) values;
(1,2,2)
endif
** END HEADER -- do not remove this line
//
// Generated on 11/09/2002
//
parameter bModal
local f
f = new SELECTForm()
if (bModal)
f.mdi = false // ensure not MDI
f.readModal()
else
f.open()
endif

class SELECTForm of FORM
with (this)
open = class::OPEN
readModal = class::READMODAL
scaleFontBold = false
height = 10.4091
left = 7.1429
top = 0
width = 71
text = "questionbogen"
endwith

this.QUERY1 = new QUERY()
this.QUERY1.parent = this
with (this.QUERY1)
left = 1.4286
top = 0.5
sql = 'Select * from "questions.dbf"'
active = true
endwith

this.RECTANGLE2 = new RECTANGLE(this)
with (this.RECTANGLE2)
left = 53
top = 2.4545
width = 16.2857
height = 6.3182
text = ""
endwith

this.RECTANGLE1 = new RECTANGLE(this)
with (this.RECTANGLE1)
left = 2.7143
top = 2.4545
width = 49.4286
height = 6.3182
text = ""
endwith

this.TEXT1 = new TEXT(this)
with (this.TEXT1)
height = 1
left = 9.4286
top = 1.3636
width = 50.4286
text = "Please answer the following questions"
endwith

this.TEXT2 = new TEXT(this)
with (this.TEXT2)
height = 1
left = 8.4286
top = 4
width = 26
text = "<p>How was your impression?</p><p></p>"
endwith

this.TEXT3 = new TEXT(this)
with (this.TEXT3)
height = 1
left = 8.4286
top = 5.5455
width = 26
text = "<p>How was your room ?</p><p></p>"
endwith

this.TEXT4 = new TEXT(this)
with (this.TEXT4)
height = 1
left = 8.4286
top = 7.0909
width = 26
text = "<p>How was the food?</p><p></p>"
endwith

this.PB1OF5_1 = new PB1OF5(this)
with (this.PB1OF5_1)
height = 0.8636
left = 34.5714
top = 4
width = 12
endwith

this.PB1OF5_2 = new PB1OF5(this)
with (this.PB1OF5_2)
height = 0.8636
left = 34.5714
top = 5.5455
width = 12
endwith

this.PB1OF5_3 = new PB1OF5(this)
with (this.PB1OF5_3)
height = 0.8636
left = 34.5714
top = 7.0909
width = 12
endwith

this.TEXT5 = new TEXT(this)
with (this.TEXT5)
height = 1
left = 35.5714
top = 2.7727
width = 2
text = "1"
endwith

this.TEXT6 = new TEXT(this)
with (this.TEXT6)
height = 1
left = 38.2857
top = 2.7727
width = 2
text = "2"
endwith

this.TEXT7 = new TEXT(this)
with (this.TEXT7)
height = 1
left = 41.4286
top = 2.7727
width = 2
text = "3"
endwith

this.TEXT8 = new TEXT(this)
with (this.TEXT8)
height = 1
left = 44.2857
top = 2.7727
width = 2
text = "4"
endwith

this.TEXT9 = new TEXT(this)
with (this.TEXT9)
height = 1
left = 47
top = 2.7727
width = 2
text = "5"
endwith

this.TEXT10 = new TEXT(this)
with (this.TEXT10)
height = 3.6364
left = 53.7143
top = 3.7727
width = 14.2857
text = "<p>1=very good</p><p>2=good</p><p>3=average</p><p>4=not
good</p><p>5=bad</p>"
endwith

this.rowset = this.query1.rowset

Function Open
this.init()
return super::open()

Function ReadModal
this.init()
return super::readmodal()

Function Init
r=form.query1.rowset
form.PB1OF5_1.datalink=r.fields["question1"]
form.PB1OF5_2.datalink=r.fields["question2"]
form.PB1OF5_3.datalink=r.fields["question3"]

form.PB1OF5_1.value=r.fields["question1"].value
form.PB1OF5_2.value=r.fields["question2"].value
form.PB1OF5_3.value=r.fields["question3"].value

//Custom Eigenschaft
r.fields["question1"].control=;
form.PB1OF5_1

r.fields["question2"].control=;
form.PB1OF5_2

r.fields["question3"].control=;
form.PB1OF5_3

r. OnNavigate=class::ne
wValues

return

function NewValues
private i
for i=1 to this.fields.size
if type("this.fields[i].control")=="O"
this.fields[i].control.value=;
this.fields[i].value
this.fields[i].control.redraw()
endif
next
endclass
class pb1of5(oParent) Of paintbox(oParent) Custom
#define GCR_WIDTH 5
#define GCR_HEIGHT 7
#define PS_SOLID 0
#define OPAQUE 2

* Create 8, 16, and 32-bit buffered values from numeric values.
#ifndef STORE8
#define store8(nVal) (chr(bitand(nVal, 255)))
#endif
#ifndef STORE16
#define store16(nVal) ;
store8(nval) + store8(bitrshift(nVa
l, 8))
#endif
#ifndef STORE32
#define store32(nVal) store8(nval) + ;
store8(bitrshift(nVa
l, 8)) +;
store8(bitrshift(nVa
l, 16)) +;
store8(bitrshift(nVa
l, 24))
#endif


* Extract 8, 16, and 32-bit numeric values from buffered values.
#ifndef MAKE8
#define make8(cBuff, nIndex) asc(substr(cBuff, nIndex))
#endif
#ifndef MAKEU16
#define makeu16(cBuff, nIndex) ;
make8(cBuff, nIndex) + bitlshift(make8(cBuf
f,;
nIndex + 1), 8)
#endif
#ifndef MAKES16
#define makes16(cBuff, nIndex) ;
iif(asc(substr(cBuff
, nIndex + 1, 1)) > 127, ;
- bitxor(makeu16(cBuff
, nIndex), 65535) - 1, ;
makeu16(cBuff, nIndex))
#endif
#ifndef MAKEU32
#define makeu32(cBuff, nIndex) ;
make8(cBuff, nIndex) + bitlshift(make8(cBuf
f,;
nIndex + 1), 8) + bitlshift(make8(cBuf
f, nIndex + 2), 16) +;
bitlshift(make8(cBuf
f, nIndex + 3), 24)
#endif
#ifndef MAKES32
#define makes32(cBuff, nIndex) ;
iif(asc(substr(cBuff
, nIndex + 3, 1)) > 127, ;
- bitxor(makeu32(cBuff
, nIndex), ;
4294967295) - 1, makeu32(cBuff, nIndex))
#endif


If Type("LockWindowUpdate") # "FP"
extern CLOGICAL LockWindowUpdate(CHA
NDLE) User32
EndIf


if type("ScreenToClient") # "FP"
extern clogical ScreenToClient(chand
le, cptr) user32
endif
if type("GetCursorPos") # "FP"
extern CVOID GetCursorPos ( CPTR ) user32
endif && type("GetCursorPos") # "FP"
if type("BeginPaint") # "FP"
extern CHANDLE BeginPaint(CHANDLE, CPTR) user32
endif && type("BeginPaint") # "FP"
if type("EndPaint") # "FP"
extern CVOID EndPaint(CHANDLE, CPTR) user32
endif && type("EndPaint") # "FP"
if type("GetClientRect") # "FP"
extern CVOID GetClientRect(CHANDL
E, CPTR) user32
endif && type("GetClientRect") # "FP"
if type("InvalidateRect") # "FP"
extern CVOID InvalidateRect ( CHANDLE,CPTR,CLOGICA
L ) user32
endif && type("InvalidateRect") # "FP"

if type("InvalidateRectCli") # "FP"
extern CVOID InvalidateRectCli;
(CHANDLE, CLONG, CLOGICAL) user32 from;
"InvalidateRect"
endif && type("InvalidateRectCli") # "FP"

if type("LineTo") # "FP"
extern CLOGICAL LineTo(CHANDLE, CINT, CINT) GDI32
endif && type("LineTo") # "FP"
if type("MoveToEx") # "FP"
extern CLONG MoveToEx(CHANDLE, CINT, CINT,CPTR) GDI32
endif && type("Moveto") # "FP"
if type("Rectangle") # "FP"
extern CLOGICAL Rectangle;
(CHANDLE, CINT, CINT, CINT, CINT) GDI32
endif && type("Rectangle") # "FP"
if type("SelectObject") # "FP"
extern CHANDLE SelectObject(CHANDLE
, CHANDLE) GDI32
endif && type("SelectObject") # "FP"
if type("SetBkColor") # "FP"
extern CLONG SetBkColor(CHANDLE, CLONG) GDI32
endif && type("SetBkColor") # "FP"
if type("SetBkMode") # "FP"
extern CINT SetBkMode(CHANDLE, CINT) GDI32
endif && type("SetBkMode") # "FP"
if type("CreatePen") # "FP"
extern CHANDLE CreatePen(CINT, CINT, CLONG) GDI32
endif && type("CreatePen") # "FP"
if type("SetRect") # "FP"
extern CVOID SetRect(CPTR, CINT, CINT, CINT, CINT) user32
endif && type("SetRect") # "FP"
if type("SetTextColor") # "FP"
extern CLONG SetTextColor(CHANDLE
, CLONG) GDI32
endif && type("SetTextColor") # "FP"
if type("UpdateWindow") # "FP"
extern CVOID UpdateWindow(CHANDLE
) user32
endif && type("UpdateWindow") # "FP"
if type("DeleteObject") # "FP"
extern CLOGICAL DeleteObject(CHANDLE
) GDI32
endif && type("DeleteObject") # "FP"
if type("CreateSolidBrush") # "FP"
extern CHANDLE CreateSolidBrush(CLO
NG) GDI32
endif && type("CreateSolidBrush") # "FP"



this.ColorNormal = "N/" + this.Parent.ColorNormal
this.value=0

this.size=20 //Seitenlänge eines Kästchens in Pixels
this.nCells=5 // Anzahl Kästchen

* Colors are in BBGGRR order.
this.panColBkgd = htoi("FFFFFF") && Hintergrundfarbe
this.ActiveBkgd = htoi("AAAAAA")

this.xPaint = space(32) && Buffer for PAINTSTRUCT structure


Function BuildSize
// Skalierung und Grösse anpassen
local xRect
xRect = space(8) && RECT structure
// Höhe und Breite in Pixel feststellen
getclientrect(this.hWND, xRect)
// Aus xRect extrahieren
this.pnPixWidth = makeu16(xRect, GCR_WIDTH) - 1
this.pnPixHeight = makeu16(xRect, GCR_HEIGHT) - 1

// Auf Formwerte umrechnen
this.pnPPUX = round(this.pnPixWidth / this.width, 0)
this.pnPPUY = round(this.pnPixHeight / this.Height, 0)
// Anpassen
this.width= ((this.nCells*this.size) )/ (this.pnPPUX)
this.height= ((1*this.size)) / (this.pnPPUY)

return true



Function Redraw
* Neuzeichnen des Objekts
invalidaterectcli(th
is.hWND, 0, .f.)
updatewindow(this.hWND)
return


Function OnPaint
//Hier wird das Ganze gezeichnet
local hDC, hDefPen, hDefBrush,s,v
//Beim ersten Zeichen Grösse anpassen
if type("this.runonce")="U"
this.runonce=this.buildsize()
endif
* Neuzeichnung beginnen
invalidaterectcli(th
is.hWND, 0, .f.)
hDC = beginpaint(this.hWND, this.xPaint)
s=this.size
v=this.value
nCells=this.nCells
* Zeichenstift und Pinsel vorbereiten
hDefPen = selectobject(hDC, createpen(PS_SOLID, 1, 0))
hDefBrush = selectobject(hDC, createsolidbrush(thi
s.panColBkgd))

for n=0 to nCells
rectangle(hDC, n*s , 0, (n+1)*s , s)
next

if this.value>0
cpoint=space(8)
//Kreuz (2 diagonale Linien) zeichnen
/*cursor auf linke obere Ecke des
selektierten Kästchens setzen*/
MoveToEx(hDC,(v-1)*s,0,cpoint)
/*Linie nach rechts unten zeichnen*/
lineto(hDC,((v-1)*s)+s,s)
//cursor auf rechte obere Ecke
MoveToEx(hDC,((v-1)*s)+s-1,0,cpoint)
/*Linie nach links unten zeichnen*/
lineto(hDC,((v-1)*s)-1,s)

endif
deleteobject(selecto
bject(hDC, hDefPen))
deleteobject(selecto
bject(hDC, hDefBrush))
EndPaint(this.hWND, this.xPaint)



Function GetPosition
local pnt, lnRow, lnCol,x
pnt = space(8)

&& returns point structure in screencoordinates
getcursorpos( pnt )
&& converts relative to this control
screentoclient(this.hwnd, pnt)
lnCol = pnt.GetByte(0) +;
BitLShift(pnt.GetByte(1), 8) +;
BitLShift(pnt.GetByte(2), 16) +;
BitLShift(pnt.GetByte(3), 24)
lnRow = pnt.GetByte(4) +;
BitLShift(pnt.GetByte(5), 8) +;
BitLShift(pnt.GetByte(6), 16) +;
BitLShift(pnt.GetByte(7), 24)


x= ceiling(lncol/this.size)
return x



Function onleftmouseup(flags,
row, col )
n=this.GetPosition()
if this.value==n
this.Setvalue(0)
else
this.Setvalue(n)
endif
this.redraw()
this.setfocus()
return

function onChar(nChar, nRepCnt, nFlags)
n=val(chr(nChar))
if n>0 and n =< this.nCells
if this.value=n
this.Setvalue(0)
else
this.Setvalue(n)
endif
this.redraw()
endif
return

Function OnGotFocus
this.SpanColBkgd=;
this.panColBkgd

this.panColBkgd=;
this.ActiveBkgd
this.redraw()
return

Function OnLostFocus
this.panColBkgd=;
this.spanColBkgd
this.redraw()
return


Function SetValue(nValue)
this.value=nValue
//Wenn an ein Feld gelinkt
if type("this.datalink.value") # "U"
this.datalink.value=nValue
endif
return

ENDCLASS

Zagrijs Venter

2006-03-16, 7:27 am

I'm not sure that I got the picture correctly, but it would seem to me that
using subforms could be the answer.

My thought go along:
a form for the warehouse
a subform for each section
a subform of the subform for each line

Each of these would then give you 4096 objects to work with.

I have done something similar to create a preview of my application in my
properties-setup form.

Downside is it would take a loooong, loooong time to load.

Zagrijs


"Omar Mohammed" <omarATprogmatix.biz> wrote in message
news:oXeu5TLSGHA.1488@news-server...
>
>
> I agree with you totally.
> However, in this case I really can't find a better option.
> The application tracks stock items within a warehouse. There are several
> warehouses, each with a different layout.
> When goods are moved from one storage bin to another, it has to be shown
> on the virtual map (it's linked to a PDA so when the transfers are made,
> the server gets updated automatically). Each lane has a number of bins and
> there are a number of lanes. What I want to do is show the warehouse
> manager at a glance where his stock is. Obviously there are more than 4096
> stock items (there's actually about 10,000 items per warehouse). So lane 1
> may have 50 sections each with 10 bins and there may be up to 10 lanes.
> So there's approx. 5000 bins in that warehouse alone. I need to represent
> each bin as something (I thought a rectangle would do), so when the
> manager clicks, he gets a picture of his warehouse and all the stock
> location.
> The program is actually complete and it works. I wrote the PDA and the
> database application and everything shows up fine on the screen. However,
> when I tested I only tested about 2000 bin locations. Didnt realise about
> this limitation.
>
> Any suggestions? It's actually as Rich mentioned, very similar to the
> program tracking seats in a concert hall done by Romain. However, I don't
> think his app. catered for 5000 seats, not too sure. I'm still looking for
> it.
>
> Thanks
>
> Omar



Robert Bravery

2006-03-16, 7:27 am

HI Omar,

Well hopefully it wont be windows resources. If so then youre stuck. What
you need is something that doesnt take up as many resources as possible.
Perhaps a textlable object (not the HTML text), or something similar.
Then also if it is indeed a dbase limitation, you miht have to subdivide
youre satock to fit on several forms. Three forms would give you 12000
objects, hopefully windows could handle that.
Robert

"Omar Mohammed" <omarATprogmatix.biz> wrote in message
news:oXeu5TLSGHA.1488@news-server...
>
>
> I agree with you totally.
> However, in this case I really can't find a better option.
> The application tracks stock items within a warehouse. There are several
> warehouses, each with a different layout.
> When goods are moved from one storage bin to another, it has to be shown
> on the virtual map (it's linked to a PDA so when the transfers are made,
> the server gets updated automatically). Each lane has a number of bins
> and there are a number of lanes. What I want to do is show the warehouse
> manager at a glance where his stock is. Obviously there are more than
> 4096 stock items (there's actually about 10,000 items per warehouse). So
> lane 1 may have 50 sections each with 10 bins and there may be up to 10
> lanes. So there's approx. 5000 bins in that warehouse alone. I need to
> represent each bin as something (I thought a rectangle would do), so
> when the manager clicks, he gets a picture of his warehouse and all the
> stock location.
> The program is actually complete and it works. I wrote the PDA and the
> database application and everything shows up fine on the screen.
> However, when I tested I only tested about 2000 bin locations. Didnt
> realise about this limitation.
>
> Any suggestions? It's actually as Rich mentioned, very similar to the
> program tracking seats in a concert hall done by Romain. However, I
> don't think his app. catered for 5000 seats, not too sure. I'm still
> looking for it.
>
> Thanks
>
> Omar



Zagrijs Venter

2006-03-16, 7:27 am

Included is turnkey example using subforms. It creates 2400 objects. Just
don't have time to play around more to see what happens.

** END HEADER -- do not remove this line
//
// Generated on 16/03/2006
//
parameter bModal
local f
f = new testForm()
if (bModal)
f.mdi = false // ensure not MDI
f.readModal()
else
f.open()
endif

class testForm of FORM
with (this)
metric = 6 // Pixels
height = 400.0
left = 13.0
top = 0.0
width = 600.0
text = ""
endwith


*------------------------------------------------------------------------------
function onOpen
*------------------------------------------------------------------------------

local nLeft, nTop, n , n2

private a, o

nLeft = 0
nTop = 0

for n=1 to 24

nLeftO = 0
nTopO = 0

a = "f"+ltrim(str(n))
&a = new subform(this)
&a..mdi = false
&a..metric = 6
&a..smallTitle := true
&a..maximize := false
&a..minimize := false
&a..sysmenu := false
&a..sizeable := false
&a..moveable := false
&a..left := nLeft
&a..top := nTop
&a..width := 100
&a..height := 100
&a..colorNormal := "0xc16100"

for n2= 1 to 100
o = "o"+ltrim(str(n2) )
&o = new rectangle(&a)
// &o..borderstyle = 3//None
&o..left = nLeftO
&o..top = nTopO
&o..width = 10
&o..height = 10

nLeftO = nLeftO+10

if nLeftO == 100
nLeftO := 0
nTopO := nTopO+10
endif

next

&a..open()

nLeft := nLeft+100
if nLeft == 600
nTop := nTop+100
nLeft := 0
endif
next

return

endclass


"Robert Bravery" <me@u.com> wrote in message
news:fkQE7LMSGHA.876@news-server...
> HI Omar,
>
> Well hopefully it wont be windows resources. If so then youre stuck. What
> you need is something that doesnt take up as many resources as possible.
> Perhaps a textlable object (not the HTML text), or something similar.
> Then also if it is indeed a dbase limitation, you miht have to subdivide
> youre satock to fit on several forms. Three forms would give you 12000
> objects, hopefully windows could handle that.
> Robert
>
> "Omar Mohammed" <omarATprogmatix.biz> wrote in message
> news:oXeu5TLSGHA.1488@news-server...
>
>



rb

2006-03-16, 7:27 am

HI,

How long does this thing take to fully load and open. To me, in my tests, it
was way way to long, and got slower as more were added, probably because
less and less resources were avau\ilable.
What are you trying to show exactly. Could it not be done in a grid,
atatched to a table somehow.

RObert

"Omar Mohammed" <omarATprogmatix.biz> wrote in message
news:Z3FW5ULSGHA.1488@news-server...
> (and >>I
> you >>could
>
>
> Rich
>
> Thanks. I tried changing it to a paintbox, but it still stopped at 4096
> Anyway I'm looking for the program now. I'm sure Romain's technique
> would be far better than mine
>
> Omar



*Lysander*

2006-03-16, 7:27 am

Omar Mohammed schrieb:

> The application tracks stock items within a warehouse. There are several
> warehouses, each with a different layout.
> When goods are moved from one storage bin to another, it has to be shown
> on the virtual map (it's linked to a PDA so when the transfers are made,
> the server gets updated automatically).


But most likely the layouts of the warehouses are not changing too
often.

How about putting a map of the warehouse-layout as a bitmap under
all those objects, which really need to be moving and dynamic?

ciao
André
Zagrijs Venter

2006-03-16, 7:27 am

Had time to play around further. Changing the rectangle's width and height
to 6 and the subform to 96 creates 256 rectangles per subform and 6144 for
the entire form, but it is SLOW to load and SLOW to respond!!! Maybe on a
computer with more resources one would get better results.

As Robert Bravery asks in another post: What do you actually want to
display?

Does each rectangle represent 1 item? or 1 type of item?
Should the warehouse manager see exactly where each individual item is or
where a particular type of item is stored and how many?

I can think of other ways to handle this that won't eat up RAM. But we need
to know exactly what you want to achieve to be able to help.

Regards

Zagrijs

"Zagrijs Venter" <me@u.net> wrote in message
news:w7hfLaMSGHA.2320@news-server...
> Included is turnkey example using subforms. It creates 2400 objects.
> Just don't have time to play around more to see what happens.
>
> ** END HEADER -- do not remove this line
> //
> // Generated on 16/03/2006
> //
> parameter bModal
> local f
> f = new testForm()
> if (bModal)
> f.mdi = false // ensure not MDI
> f.readModal()
> else
> f.open()
> endif
>
> class testForm of FORM
> with (this)
> metric = 6 // Pixels
> height = 400.0
> left = 13.0
> top = 0.0
> width = 600.0
> text = ""
> endwith
>
>
> *------------------------------------------------------------------------------
> function onOpen
> *------------------------------------------------------------------------------
>
> local nLeft, nTop, n , n2
>
> private a, o
>
> nLeft = 0
> nTop = 0
>
> for n=1 to 24
>
> nLeftO = 0
> nTopO = 0
>
> a = "f"+ltrim(str(n))
> &a = new subform(this)
> &a..mdi = false
> &a..metric = 6
> &a..smallTitle := true
> &a..maximize := false
> &a..minimize := false
> &a..sysmenu := false
> &a..sizeable := false
> &a..moveable := false
> &a..left := nLeft
> &a..top := nTop
> &a..width := 100
> &a..height := 100
> &a..colorNormal := "0xc16100"
>
> for n2= 1 to 100
> o = "o"+ltrim(str(n2) )
> &o = new rectangle(&a)
> // &o..borderstyle = 3//None
> &o..left = nLeftO
> &o..top = nTopO
> &o..width = 10
> &o..height = 10
>
> nLeftO = nLeftO+10
>
> if nLeftO == 100
> nLeftO := 0
> nTopO := nTopO+10
> endif
>
> next
>
> &a..open()
>
> nLeft := nLeft+100
> if nLeft == 600
> nTop := nTop+100
> nLeft := 0
> endif
> next
>
> return
>
> endclass
>
>
> "Robert Bravery" <me@u.com> wrote in message
> news:fkQE7LMSGHA.876@news-server...
>
>



Omar Mohammed

2006-03-16, 9:23 am

>
> Does each rectangle represent 1 item? or 1 type of item?
> Should the warehouse manager see exactly where each individual item is or
> where a particular type of item is stored and how many?
>

Each rectangle represents a bin (call it a box or pallet) that contains
1 type of item. There are several quantities of 1 item in the bin, but
the items are the same. Another part of the program tracks stock, this
portion simply displays a map.

BTW I'm using db2k which doesn't do subforms. I can upgrade but if the
process is slow it won't make sense

Thanks
Omar Mohammed

2006-03-16, 9:23 am


> How about putting a map of the warehouse-layout as a bitmap under all
> those objects, which really need to be moving and dynamic?
>


This was the first thing I thought about. However, there are a few problems

1) My client is still designing the layout (thus the layout will change)
and they don't know exactly what the final layout will be. I want
something flexibile enough to work with any layout. Even after the final
layout, they'll still be changing the layout and adding new warehouses
every few months to accomodate stock.

2) If this program is successfull, they will recommend it to their other
companies and they'll want the same thing. I don't want to have to go
and reprogram everytime there's a new map. Sure I'll get more money for
configuration, but I'd rather not do it.

Thanks
Omar Mohammed

2006-03-16, 9:23 am


> What are you trying to show exactly. Could it not be done in a grid,
> atatched to a table somehow.
>


Thought it this too. At the time, a grid was too difficult to convert
into a map, a rectangle looked much easier to do (as it was MUCH easier,
the whole map part took me about an hour to complete, just the
limitation was the problem).

Maybe I'm approaching this entire thing wrong. I'm going to leave it for
a day, then come back to it.

I appreciate EVERYONE's response. You have been very helpful. Of course
I have to get this working since it means some income for me. I'll just
leave it for a day and come back to it on Saturday

Thanks again

Omar
Zagrijs Venter

2006-03-16, 9:23 am


"Omar Mohammed" <omarATprogmatix.biz> wrote in message
news:GofVTCQSGHA.592@news-server...
> Each rectangle represents a bin (call it a box or pallet) that contains 1
> type of item. There are several quantities of 1 item in the bin, but the
> items are the same. Another part of the program tracks stock, this portion
> simply displays a map.
>
> BTW I'm using db2k which doesn't do subforms. I can upgrade but if the
> process is slow it won't make sense
>
> Thanks


Point about dB2K taken. You can create "subforms" in dB2K, but it requires
extra programming - getting SDI forms to accept one SDI form as their
parent. Roberrt Bravery pioneered it and published an article in dBase
Bullitin. I followed his example. The advent of subforms in dBase Plus
just made it easier. But if you have not worked with it before, I won't
suggest that you start now, especially in view of the fact that it SLOWS
down everything to load so many objects in memory.

I include another turnkey example using rectangles as vertical progress
objects changing size all the time. Run it and see if it could maybe be
adapted to do what you want to achieve.

** END HEADER -- do not remove this line
//
// Generated on 16/03/2006
//
parameter bModal
local f
f = new testForm()
if (bModal)
f.mdi = false // ensure not MDI
f.readModal()
else
f.open()
endif

class testForm of FORM
with (this)
metric = 6 // Pixels
height = 242.0
left = 201.0
top = 29.0
width = 427.0
text = ""
endwith

this.RECTANGLE1 = new RECTANGLE(this)
with (this.RECTANGLE1)
left = 30.0
top = 220.0
width = 27.0
height = 0.0
text = ""
colorNormal = "red/red"
borderStyle = 3 // None
endwith

this.RECTANGLE2 = new RECTANGLE(this)
with (this.RECTANGLE2)
left = 57.0
top = 220.0
width = 27.0
height = 0.0
text = ""
colorNormal = "red/0x80ff00"
borderStyle = 3 // None
endwith

this.RECTANGLE3 = new RECTANGLE(this)
with (this.RECTANGLE3)
left = 84.0
top = 220.0
width = 27.0
height = 0.0
text = ""
colorNormal = "red/blue"
borderStyle = 3 // None
endwith

this.RECTANGLE4 = new RECTANGLE(this)
with (this.RECTANGLE4)
left = 111.0
top = 220.0
width = 27.0
height = 0.0
text = ""
colorNormal = "red/0x80ffff"
borderStyle = 3 // None
endwith

this.RECTANGLE5 = new RECTANGLE(this)
with (this.RECTANGLE5)
left = 138.0
top = 220.0
width = 27.0
height = 0.0
text = ""
colorNormal = "red/0xff80ff"
borderStyle = 3 // None
endwith

this.RECTANGLE6 = new RECTANGLE(this)
with (this.RECTANGLE6)
left = 165.0
top = 220.0
width = 27.0
height = 0.0
text = ""
colorNormal = "red/0x404080"
borderStyle = 3 // None
endwith

this.RECTANGLE7 = new RECTANGLE(this)
with (this.RECTANGLE7)
left = 192.0
top = 220.0
width = 27.0
height = 0.0
text = ""
colorNormal = "red/0x80ff80"
borderStyle = 3 // None
endwith

this.RECTANGLE8 = new RECTANGLE(this)
with (this.RECTANGLE8)
left = 219.0
top = 220.0
width = 27.0
height = 0.0
text = ""
colorNormal = "red/0x80ffff"
borderStyle = 3 // None
endwith

this.RECTANGLE9 = new RECTANGLE(this)
with (this.RECTANGLE9)
left = 246.0
top = 220.0
width = 27.0
height = 0.0
text = ""
colorNormal = "olive/olive"
borderStyle = 3 // None
endwith

this.PUSHBUTTON1 = new PUSHBUTTON(this)
with (this.PUSHBUTTON1)
onClick = class::PUSHBUTTON1_O
NCLICK
height = 24.0
left = 309.0
top = 189.0
width = 107.0
text = "Start"
endwith


function PUSHBUTTON1_onClick

this.enabled := false

form.Graph_run()

return

function Graph_run


for n=1 to 1000

form.rectangle1.top := form.rectangle1.top-1
form.rectangle1.height := form.rectangle1.height+1

if n>=10

form.rectangle2.top := form.rectangle2.top-1
form.rectangle2.height := form.rectangle2.height+1

endif

if n>=20

form.rectangle3.top := form.rectangle3.top-1
form.rectangle3.height := form.rectangle3.height+1

endif

if n>=30

form.rectangle4.top := form.rectangle4.top-1
form.rectangle4.height := form.rectangle4.height+1

endif

if n>=40

form.rectangle5.top := form.rectangle5.top-1
form.rectangle5.height := form.rectangle5.height+1

endif

if n>=50

form.rectangle6.top := form.rectangle6.top-1
form.rectangle6.height := form.rectangle6.height+1

endif

if n>=60

form.rectangle7.top := form.rectangle7.top-1
form.rectangle7.height := form.rectangle7.height+1

endif

if n>=70

form.rectangle8.top := form.rectangle8.top-1
form.rectangle8.height := form.rectangle8.height+1

endif

if n>=80

form.rectangle9.top := form.rectangle9.top-1
form.rectangle9.height := form.rectangle9.height+1

endif

if form.rectangle1.height == 104
form.rectangle1.height := 0
form.rectangle1.top := 220
endif

if form.rectangle2.height == 104
form.rectangle2.height := 0
form.rectangle2.top := 220
endif

if form.rectangle3.height == 104
form.rectangle3.height := 0
form.rectangle3.top := 220
endif

if form.rectangle4.height == 104
form.rectangle4.height := 0
form.rectangle4.top := 220
endif

if form.rectangle5.height == 104
form.rectangle5.height := 0
form.rectangle5.top := 220
endif

if form.rectangle6.height == 104
form.rectangle6.height := 0
form.rectangle6.top := 220
endif

if form.rectangle7.height == 104
form.rectangle7.height := 0
form.rectangle7.top := 220
endif

if form.rectangle8.height == 104
form.rectangle8.height := 0
form.rectangle8.top := 220
endif

if form.rectangle9.height == 104
form.rectangle9.height := 0
form.rectangle9.top := 220
endif

sleep 0.01

next

form.pushbutton1.enabled := true

return

endclass


Ken B

2006-03-16, 9:23 am

Why not use a spreadsheet? You can change the color of the Cell by
formating the cell.


*Lysander*

2006-03-16, 9:23 am

Omar Mohammed schrieb:

> 2) If this program is successfull, they will recommend it to their other
> companies and they'll want the same thing. I don't want to have to go
> and reprogram everytime there's a new map. Sure I'll get more money for
> configuration, but I'd rather not do it.


That's a very good reason to try and find a more suitable solution.
To get more orders is the cream on the cake to work for.

But whatever you do, and no matter which programming language you
are using, a total of more than 1.000 GDI-Objects in 1 form will be
an absolute show-stopper. Just as windows is constructed, whenever
it must adress the handle in RAM for any GDI object, it must search
up and down a list of objects. And of course this will be taking
longer when the list is longer.

Did you do some testing with other applications?
I have here an e-mail program which needs a lot of GDI-references as
well. It uses more than 200 user-objects and more than 300
GDI-objetcs, and by that, it is already the "king" of the list.

Open your taks-manager, and chose "chose columns" from the main menu.
Click the checkboxes for "user objects" and "GDI objects" and then
take a look at your application, and see how much it is using in
comparison to others.

Whatever you do, you must make sure that those numbers won't be too
high.

ciao,
André
Omar Mohammed

2006-03-16, 9:23 am

In-Reply-To: <aBYPuSQSGHA.592@news-server>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Message-ID: <NZYUHiQSGHA.592@news-server>
Newsgroups: dbase.programming
Lines: 22
Path: news-server
Xref: news-server dbase.programming:10519
NNTP-Posting-Host: cuscon15048.tstt.net.tt 200.108.28.109

Roberrt Bravery pioneered it and published an article in dBase

> Bullitin. I followed his example. The advent of subforms in dBase Plus
> just made it easier. But if you have not worked with it before, I won't
> suggest that you start now, especially in view of the fact that it SLOWS
> down everything to load so many objects in memory.



Yes I remember that article. I tinkered with it a while and then dropped it.
That was a very neat program you have there.
Thinking about it after a while I figure that all I need are 3 objects.
A paintbox, rectangle and something else. That way I can get 12000
(4096*3) total objects which is more than enough to represent what I'm
looking for (I hope).
When the total number of rectangles reaches say 4000 the objects will
change to paintbox. Just a theory. But I'm going to test it out

Thanks

Omar
Omar Mohammed

2006-03-16, 9:23 am

>
> But whatever you do, and no matter which programming language you are
> using, a total of more than 1.000 GDI-Objects in 1 form will be an
> absolute show-stopper.

I understand. But I really don't know what else to try.

> Did you do some testing with other applications?

Nope.


> Open your taks-manager, and chose "chose columns" from the main menu.
> Click the checkboxes for "user objects" and "GDI objects" and then take
> a look at your application, and see how much it is using in comparison
> to others.
>
> Whatever you do, you must make sure that those numbers won't be too high.


Thanks. Never really thought of this.

I'm going to give it a whirl.
Omar Mohammed

2006-03-16, 11:24 am

OK. I did some more tinkering, based on suggestions and ideas given.
Here's what I found. At least in my instance

There's only a total of 4096 components allowed per form. No matter what
combination, textboxes, rectangles, etc. You're only allowed 4096 in
TOTAL. Even on several pages you're only allowed that amount

If you use a container (similar to a sub form), then EACH container is
allowed 4096, and you're allowed 4096 containers per form (I assume,
didn't test 4096 container, i tested with 10).

In this application, I have about 10 lanes or so per warehouse and there
are about 500 bins (or rectangles) per lane.
I've put each lane as a container and put the rectangles in the container.
It works -somewhat. I'm having a bit of a problem positioning the
containers to resize and fit the lane size, but I think that's minor.
I believe I may have solved the problem, thanks to all your help. I
really would not have been able to do it without your kind assistance.

One point, it DOES run slow (it takes 1 min to run on a P4 machine with
256 MB RAM). My computer takes about 15 secs.

But I know my client won't worry about that for now. I'll just try to
speed it up in the next release

Thanks again

Omar
Todd Kreuter

2006-03-16, 8:23 pm



Omar Mohammed wrote:
>
>
> One point, it DOES run slow (it takes 1 min to run on a P4 machine with
> 256 MB RAM). My computer takes about 15 secs.
>
> But I know my client won't worry about that for now. I'll just try to
> speed it up in the next release


You might consider doing a level based system where you start with higer
level objects then drill down to lower level objects. Say you start with
warehouses, click on a warehouse and display the warehouse floor, click
on an a row and display the rows bins. You can then release objects from
lower levels as you proceed back up.

Instead of using multiple rectanges, you could use one image that
contains a drawing of the bins. So long as the bins are the same size
you can determine what bin the user clicks by doing a bit of math.

--
Todd Kreuter [dBVIPS]
Omar Mohammed

2006-03-16, 8:23 pm

>
> Instead of using multiple rectanges, you could use one image that
> contains a drawing of the bins. So long as the bins are the same size
> you can determine what bin the user clicks by doing a bit of math.
>


It's definetly food for thought for the next release of the program.
Right now I just want to get it to the client.
Question: Won't an image take up more resources than a rectangle?
Or what you're suggesting is a better look? It will look better than
boring rectangles, but I was wondering about the resources.
I know with your suggestion by the time you reach that level of drill
down, there will only be about 50 or so to contend with, so it looks
like a good idea, but I'll give it to the client, then work on the next
release.
Thanks
Todd Kreuter

2006-03-16, 8:23 pm

Omar Mohammed wrote:
>
> It's definetly food for thought for the next release of the program.
> Right now I just want to get it to the client.
> Question: Won't an image take up more resources than a rectangle?
> Or what you're suggesting is a better look? It will look better than
> boring rectangles, but I was wondering about the resources.
> I know with your suggestion by the time you reach that level of drill
> down, there will only be about 50 or so to contend with, so it looks
> like a good idea, but I'll give it to the client, then work on the next
> release.


A form containing an image that has 500 rectangles drawn within the
image uses 1 resource, the image.


--
Todd Kreuter [dBVIPS]
Rick

2006-03-16, 8:23 pm

Omar,

If I understand the problem, and if it would work to show the manager the warehouse at the larger level of lanes, how about 2 levels. Show the manager color coded lanes iin on one form, the bins in each lane in another? This would give you up to 4096 l
anes in one form, and 4096 bins per lane.

Just an idea.

Rick

Omar Mohammed <omarATprogmatix.biz> Wrote:

>
>
> I agree with you totally.
> However, in this case I really can't find a better option.
> The application tracks stock items within a warehouse. There are several
> warehouses, each with a different layout.
> When goods are moved from one storage bin to another, it has to be shown
> on the virtual map (it's linked to a PDA so when the transfers are made,
> the server gets updated automatically). Each lane has a number of bins
> and there are a number of lanes. What I want to do is show the warehouse
> manager at a glance where his stock is. Obviously there are more than
> 4096 stock items (there's actually about 10,000 items per warehouse). So
> lane 1 may have 50 sections each with 10 bins and there may be up to 10
> lanes. So there's approx. 5000 bins in that warehouse alone. I need to
> represent each bin as something (I thought a rectangle would do), so
> when the manager clicks, he gets a picture of his warehouse and all the
> stock location.
> The program is actually complete and it works. I wrote the PDA and the
> database application and everything shows up fine on the screen.
> However, when I tested I only tested about 2000 bin locations. Didnt
> realise about this limitation.
>
> Any suggestions? It's actually as Rich mentioned, very similar to the
> program tracking seats in a concert hall done by Romain. However, I
> don't think his app. catered for 5000 seats, not too sure. I'm still
> looking for it.
>
> Thanks
>
> Omar


Omar Mohammed

2006-03-16, 8:23 pm


>
>
> A form containing an image that has 500 rectangles drawn within the
> image uses 1 resource, the image.
>
>


OOOHhhhhhh .... .. makes sense.
Thanks
Omar Mohammed

2006-03-16, 8:23 pm

Rick wrote:
> Omar,
>
> If I understand the problem, and if it would work to show the manager the warehouse at the larger level of lanes,


how about 2 levels. Show the manager color coded lanes iin on one form,
the bins in each lane in another?

This would give you up to 4096 lanes in one form, and 4096 bins per lane.
>
> Just an idea.
>
> Rick


And not a bad one too. I can use that. It shouldn't be that hard to
program.
Thanks
Ivar B. Jessen

2006-03-16, 8:23 pm

On Wed, 15 Mar 2006 18:29:14 -0400, in dbase.programming,
Subject: Maximum number of form components,
Message-ID: <yUBu2DISGHA.876@news-server>,
Omar Mohammed <omarATprogmatix.biz> wrote:

>I am trying to write an app (this is dB2k 0.4 BTW) that would draw
>rectangles on a form.
>All the rectangles are the same size. Basically a counter starts from 1
>and goes to a total.
>The problem is when I reach 4095 rectangles I get
>"not enough memory for this operation".



Omar,

Use shapes. As I understand it they are not really objects, only something drawn
on the form, so they do not use up memory.

Try the form below my signature, it draws 75*75 = 5625 colored circles without
any prolems, but it is slow.

You need to organize the dots in meaningful groups otherwise the warehouse
manager will go crazy in a very short time from looking at this form :-)


Ivar B. Jessen

//-----
** END HEADER -- do not remove this line
//
// Generated on 16-03-2006
//
parameter bModal
local f
f = new bigShapeForm()
if (bModal)
f.mdi = false // ensure not MDI
f.readModal()
else
f.open()
endif

class bigShapeForm of FORM
with (this)
onOpen = class::FORM_ONOPEN
metric = 6 // Pixels
colorNormal = "white"
height = 770
left = 0.0
top = 0.0
width = 780
text = ""
endwith


function form_onOpen
for i = 1 to 75
for j = 1 to 75
s = new shape(this)
s.shapesTyle = 3 // Circle

if i%10 == 0 or j%10 == 0
s.colorNormal = "blue/blue"
else
s.colorNormal = "red/red"
endif

s.width = 5
s.height = 5
s.left = i*10
s.top = j*10
next j
next i
return
endclass
//-----
Todd Kreuter

2006-03-16, 8:23 pm

Omar Mohammed wrote:
>
>
> OOOHhhhhhh .... .. makes sense.
> Thanks


I posted a sample of this in the binaries news group. The only down side
to something like this is that the image is pretty much static.

--
Todd Kreuter [dBVIPS]
Omar Mohammed

2006-03-16, 8:23 pm


>
>
> I posted a sample of this in the binaries news group. The only down side
> to something like this is that the image is pretty much static.
>


Which, in my case, is not really a downside.
It looks really neat. I'll have to investigate this a bit further
Thanks a lot
Omar Mohammed

2006-03-16, 8:23 pm


>
> Try the form below my signature, it draws 75*75 = 5625 colored circles without
> any prolems, but it is slow.


WE'VE FOUND THE PROBLEM!!!!
Thanks Ivar

OK the first problem is that I'm a ninny <G>
But anyway I don't think that's too easy to solve. So here's the program
problem

My first rectangle is called 'REC1', my second 'REC2', and so on
I thought that each rectangle had to have a unique name. When you're
designing it in the form layout, you can't have the same name. But when
I looked at the code in your program, and the code in Todd's program (OH
Thanks to Todd, too) it didn't give each shape/image a new name. So I
took out my naming (basically a counter starting from 1 and
incrementing), and tested it using the same name for each rectangle.
I actually plotted a form with 8000 rectangles with no errors. It was
slow, but it worked.

It's interesting and confusing at the same time. I'm guessing each new
component's name is allocated memory, not each component.

I'm armed with 2 good pieces of software (Todd and Ivar). Unfortunately,
it may be a bit too late to use it in the firstl release, but I will use
it in the second.

Thanks again, guys. You were very very helpful

Regards
Omar Mohammed

2006-03-16, 8:23 pm

In-Reply-To: <YiYMSOVSGHA.1148@news-server>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Message-ID: <rQkROkVSGHA.2016@news-server>
Newsgroups: dbase.programming
Lines: 19
Path: news-server
Xref: news-server dbase.programming:10533
NNTP-Posting-Host: cuscon15048.tstt.net.tt 200.108.28.109

Omar Mohammed wrote:
>
>
> Which, in my case, is not really a downside.
> It looks really neat. I'll have to investigate this a bit further
> Thanks a lot


OK I didn't quite understand what you meant by the image being static.
At first I thought it was 1 bin drawn within a shape 120 times, and that
1 bin's shape was staic. But now I realise that the actual 120 bins is
1 image. I believe, though, you're on to something here. I can represent
1 bin per image and just drill down (as you suggested before) by double
clicking. It should work
Can't wait to start version 1.1
Ivar B. Jessen

2006-03-17, 7:23 am

On Thu, 16 Mar 2006 20:01:34 -0400, in dbase.programming,
Subject: Re: Maximum number of form components,
Message-ID: <ZCIIHcVSGHA.2016@news-server>,
Omar Mohammed <omarATprogmatix.biz> wrote:

>WE'VE FOUND THE PROBLEM!!!!
>Thanks Ivar
>
>OK the first problem is that I'm a ninny <G>
>But anyway I don't think that's too easy to solve. So here's the program
>problem
>
>My first rectangle is called 'REC1', my second 'REC2', and so on
>I thought that each rectangle had to have a unique name. When you're
>designing it in the form layout, you can't have the same name. But when
>I looked at the code in your program, and the code in Todd's program (OH
>Thanks to Todd, too) it didn't give each shape/image a new name. So I
>took out my naming (basically a counter starting from 1 and
>incrementing), and tested it using the same name for each rectangle.
>I actually plotted a form with 8000 rectangles with no errors. It was
>slow, but it worked.
>
>It's interesting and confusing at the same time. I'm guessing each new
>component's name is allocated memory, not each component.
>
>I'm armed with 2 good pieces of software (Todd and Ivar). Unfortunately,
>it may be a bit too late to use it in the firstl release, but I will use
>it in the second.



As illustrated in demo below my signature you can get the number of the
rectangle by clicking on it. This number could be use as an entry in a
translation table from which you find the correct name of lane, section, bin and
contents of bin etc.

You also need to have some code for the case when bins are added to a section
whereby all following bins have to be renamed.

The demo also illustrates the need for the selected bin to behighlighted when
selected, I will leave that up to you.

>Thanks again, guys. You were very very helpful


You are welcome


Ivar B. Jessen

//-----
** END HEADER -- do not remove this line
//
// Generated on 17-03-2006
//
parameter bModal
local f
f = new bigShapeForm()
if (bModal)
f.mdi = false // ensure not MDI
f.readModal()
else
f.open()
endif

class bigShapeForm of FORM
with (this)
onLeftMouseDown = class::FORM_ONLEFTMO
USEDOWN
onOpen = class::FORM_ONOPEN
metric = 6 // Pixels
colorNormal = "white"
height = 200.0
left = 417.0
top = 202.0
width = 208.0
text = ""
endwith


function form_onLeftMouseDown
(flags, col, row)

extern CHANDLE GetDC(CHANDLE) User32
extern CULONG GetPixel(CHANDLE, CINT, CINT) GDI32
extern CULONG SetPixel(CHANDLE, CINT, CINT, CINT) GDI32
extern CINT ReleaseDC(CHANDLE, CHANDLE) User32

// calculate coordinates to upper left corner of shape
x = col - col%10
y = row - row%10

// calculate shape number
n = x/10 + (y/10 - 1)*10

hWndDC = GetDC(form.hWndClient)
nColor = GetPixel(hWndDC, row, col)
ReleaseDC(this.hWnd, hWndDC)

do case
case nColor = 0xFFFFFF
cColor = "White"
case nColor = 0x0000FF
cColor = "Red"
case nColor = 0xFF0000
cColor = "Blue"
otherwise
cColor = "Unknown"
endcase

if cColor = "White"
msgbox("Try to aim better next time")
else
msgbox( "Bin number " + int(n) + chr(10) + chr(10) + ;
"The color is " + cColor )
endif
return

function form_onOpen
for i = 1 to 10
for j = 1 to 10

s = new shape(this)
s.shapeStyle = 5 // Square

if i%10 == 0 or j%10 == 0
s.colorNormal = "blue/blue"
else
s.colorNormal = "red/red"
endif

s.width = 5
s.height = 5
s.left = i*10
s.top = j*10

next j
next i
return

endclass
//-----
Todd Kreuter

2006-03-17, 9:23 am

Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Newsgroups: dbase.programming
Lines: 6
Path: news-server
Xref: news-server dbase.programming:10540
NNTP-Posting-Host: h-66-134-1-4.atlngahp.covad.net 66.134.1.4

Omar Mohammed wrote:
>
> Which, in my case, is not really a downside.
> It looks really neat. I'll have to investigate this a bit further
> Thanks a lot


You're welcome, Omar.

--
Todd Kreuter [dBVIPS]
Omar Mohammed

2006-03-17, 8:23 pm


>
> As illustrated in demo below my signature you can get the number of the
> rectangle by clicking on it. This number could be use as an entry in a
> translation table from which you find the correct name of lane, section, bin and
> contents of bin etc.



Ahhh .. API calls. My FAVOURITE (I wish)

Thanks. I'll take a look at it and try to use it in ver. 1.1
Ivar B. Jessen

2006-03-18, 3:25 am

On Fri, 17 Mar 2006 22:21:37 -0400, in dbase.programming,
Subject: Re: Maximum number of form components,
Message-ID: <tnjZHPjSGHA.2320@news-server>,
Omar Mohammed <omarATprogmatix.biz> wrote:

>
>
>
>Ahhh .. API calls. My FAVOURITE (I wish)



The code below shows a simple way to highlight the selected bin.


Ivar B. Jessen

//-----
** END HEADER -- do not remove this line
//
// Generated on 17-03-2006
//
parameter bModal
local f
f = new bigShapeForm()
if (bModal)
f.mdi = false // ensure not MDI
f.readModal()
else
f.open()
endif

class bigShapeForm of FORM
with (this)
onLeftMouseDown = class::FORM_ONLEFTMO
USEDOWN
onOpen = class::FORM_ONOPEN
metric = 6 // Pixels
colorNormal = "white"
height = 200.0
left = 4.0
top = 26.0
width = 208.0
text = ""
endwith

this.SHAPE1 = new SHAPE(this)
with (this.SHAPE1)
left = 0
top = 0
width = 14.0
height = 14.0
shapeStyle = 5 // Square
penWidth = 1
endwith


function form_onLeftMouseDown
(flags, col, row)

extern CHANDLE GetDC(CHANDLE) User32
extern CULONG GetPixel(CHANDLE, CINT, CINT) GDI32
extern CULONG SetPixel(CHANDLE, CINT, CINT, CINT) GDI32
extern CINT ReleaseDC(CHANDLE, CHANDLE) User32

// calculate coordinates to upper left corner of shape
x = col - col%10
y = row - row%10

// calculate shape number
n = x/10 + (y/10 - 1)*10

this.shape1.left = x-4.0
this.shape1.top = y-4.0

hWndDC = GetDC(form.hWndClient)
nColor = GetPixel(hWndDC, row, col)
ReleaseDC(this.hWnd, hWndDC)

do case
case nColor = 0xFFFFFF
cColor = "White"
case nColor = 0x0000FF
cColor = "full" //"Red"
case nColor = 0xFF0000
cColor = "empty" //"Blue"
otherwise
cColor = "Unknown"
endcase

if cColor = "White"
msgbox("Try to aim better next time")
else
this.shape1.visible = true
msgbox( "Bin number " + int(n) + "." + chr(10) + chr(10) + ;
"The bin is " + cColor + ".")
this.shape1.visible = false
endif
return

function form_onOpen
this.shape1.visible = false
for i = 1 to 10
for j = 1 to 10
s = new shape(this)
s.shapeStyle = 5 // Square

if i%10 == 0 or j%10 == 0
s.colorNormal = "blue/blue"
else
s.colorNormal = "red/red"
endif
s.width = 5
s.height = 5
s.left = i*10
s.top = j*10
next j
next i
return
endclass
//-----
Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com