Help.. as I'm really lost....
Had an abl window that called a .net class, next time I recompilled, It won't run... reverted to stored versions, but to no avail...
Calling program makes this:
USING Procs.Ven.ven06100 FROM PROPATH. .... PROCEDURE MuestraAvance : DEFINE INPUT PARAMETER pVendedor AS INTEGER NO-UNDO. DEFINE INPUT PARAMETER pNumVenta AS INTEGER NO-UNDO. DEFINE VARIABLE oForm AS procs.ven.ven06100 NO-UNDO . oForm = NEW procs.ven.ven06100(pVendedor, pNumVenta) . WAIT-FOR System.Windows.Forms.Application:Run (oForm) . CATCH err AS Progress.Lang.Error: MESSAGE err:GetMessage (1) VIEW-AS ALERT-BOX . END CATCH. END PROCEDURE.
On called Class, got this...
USING Progress.Windows.Form. USING system.Drawing.*. BLOCK-LEVEL ON ERROR UNDO, THROW. CLASS Procs.Ven.ven06100 INHERITS Form : DEFINE PRIVATE VARIABLE components AS System.ComponentModel.IContainer NO-UNDO. DEFINE PRIVATE VARIABLE buttonOk AS System.Windows.Forms.Button NO-UNDO. DEFINE PRIVATE VARIABLE fNombreEmpleado AS System.Windows.Forms.Label NO-UNDO. DEFINE PRIVATE VARIABLE fTickets AS System.Windows.Forms.TextBox NO-UNDO. DEFINE PRIVATE VARIABLE LabelKilos AS System.Windows.Forms.Label NO-UNDO. DEFINE PRIVATE VARIABLE LAbelTicket AS System.Windows.Forms.Label NO-UNDO. DEFINE PRIVATE VARIABLE LAvance AS System.Windows.Forms.Label NO-UNDO. DEFINE PRIVATE VARIABLE LNumeroTickets AS System.Windows.Forms.Label NO-UNDO. DEFINE PRIVATE VARIABLE progressBar1 AS System.Windows.Forms.ProgressBar NO-UNDO. DEFINE PRIVATE VARIABLE textBox1 AS System.Windows.Forms.TextBox NO-UNDO. DEFINE PRIVATE VARIABLE textKilos AS System.Windows.Forms.TextBox NO-UNDO. CONSTRUCTOR PUBLIC ven06100( xVendedor AS INTEGER, xVenta AS INTEGER): SUPER(). InitializeComponent ( ). CargaDatos(xVenta, xVendedor). CATCH e AS Progress.Lang.Error: UNDO, THROW e. END CATCH. END CONSTRUCTOR. DESTRUCTOR PUBLIC ven06100( ): IF VALID-OBJECT(components) THEN DO: CAST(components, System.IDisposable):Dispose(). END. END DESTRUCTOR. METHOD PROTECTED VOID CargaDatos (INPUT pVenta AS INTEGER, INPUT pVendedor AS INTEGER): DEFINE VARIABLE ValMax AS CHARACTER NO-UNDO. RUN func\GetCFG.p("Meta de Ventas", "", "", OUTPUT ValMax). IF ValMax = "" THEN DO: RUN func\SetCFG.P("Meta de Ventas", "", "", 1, 250). ValMax = "250". END. FIND Ticket NO-LOCK WHERE Ticket.Ticket = pVenta NO-ERROR. FIND VendedorDia NO-LOCK WHERE VendedorDia.Fecha = TODAY AND VendedorDia.Nomina = pVendedor NO-ERROR. IF NOT AVAILABLE VendedorDia THEN RETURN. // primer venta del dia. no hay registro hasta que se cobra. FIND Empleado NO-LOCK WHERE Empleado.Nomina = pVendedor. FNombreEmpleado:text = Empleado.Nombre. textBox1:text = STRING(pVenta). lAvance:TEXT = "Meta de Venta". fTickets:text = STRING(VendedorDia.Tickets). progressBar1:MAXIMUM = max(INTEGER(ValMax), VendedorDia.Cantidad). progressBar1:value = VendedorDia.Cantidad. textKilos:TEXT = STRING(VendedorDia.Cantidad). /* IF INTEGER(ValMax) < VendedorDia.Cantidad THEN */ /* DO: */ /* textKilos:BackColor = System.Drawing.Color.Lime.*/ /* END. */ END METHOD. METHOD PRIVATE VOID okButton_Click (sender AS System.Object, e AS System.EventArgs): THIS-OBJECT:DialogResult = System.Windows.Forms.DialogResult:Ok. THIS-OBJECT:Close ( ). END METHOD. METHOD PRIVATE VOID cancelButton_Click (sender AS System.Object, e AS System.EventArgs): THIS-OBJECT:DialogResult = System.Windows.Forms.DialogResult:Cancel. THIS-OBJECT:Close ( ). END METHOD. METHOD PRIVATE VOID InitializeComponent ( ): /* NOTE: The following method is automatically generated. We strongly suggest that the contents of this method only be modified using the Visual Designer to avoid any incompatible modifications. Modifying the contents of this method using a code editor will invalidate any support for this file. */ THIS-OBJECT:buttonOk = NEW System.Windows.Forms.Button(). THIS-OBJECT:progressBar1 = NEW System.Windows.Forms.ProgressBar(). THIS-OBJECT:textBox1 = NEW System.Windows.Forms.TextBox(). THIS-OBJECT:LAbelTicket = NEW System.Windows.Forms.Label(). THIS-OBJECT:LAvance = NEW System.Windows.Forms.Label(). THIS-OBJECT:LNumeroTickets = NEW System.Windows.Forms.Label(). THIS-OBJECT:fTickets = NEW System.Windows.Forms.TextBox(). THIS-OBJECT:fNombreEmpleado = NEW System.Windows.Forms.Label(). THIS-OBJECT:textKilos = NEW System.Windows.Forms.TextBox(). THIS-OBJECT:LabelKilos = NEW System.Windows.Forms.Label(). THIS-OBJECT:SuspendLayout(). /* */ /* buttonOk */ /* */ DEFINE VARIABLE nestedvar0 AS System.Windows.Forms.AnchorStyles NO-UNDO. nestedvar0 = System.Windows.Forms.AnchorStyles:Bottom. THIS-OBJECT:buttonOk:Anchor = CAST(Progress.Util.EnumHelper:Or(nestedvar0, System.Windows.Forms.AnchorStyles:Right), System.Windows.Forms.AnchorStyles). THIS-OBJECT:buttonOk:Location = NEW System.Drawing.Point(906, 632). THIS-OBJECT:buttonOk:Name = "buttonOk". THIS-OBJECT:buttonOk:Size = NEW System.Drawing.Size(75, 64). THIS-OBJECT:buttonOk:TabIndex = 0. THIS-OBJECT:buttonOk:Text = "OK". THIS-OBJECT:buttonOk:UseCompatibleTextRendering = TRUE. THIS-OBJECT:buttonOk:Click:Subscribe(THIS-OBJECT:okButton_Click). /* */ /* progressBar1 */ /* */ THIS-OBJECT:progressBar1:Location = NEW System.Drawing.Point(180, 132). THIS-OBJECT:progressBar1:Name = "progressBar1". THIS-OBJECT:progressBar1:Size = NEW System.Drawing.Size(606, 23). THIS-OBJECT:progressBar1:TabIndex = 1. /* */ /* textBox1 */ /* */ THIS-OBJECT:textBox1:Location = NEW System.Drawing.Point(881, 56). THIS-OBJECT:textBox1:Name = "textBox1". THIS-OBJECT:textBox1:Size = NEW System.Drawing.Size(93, 20). THIS-OBJECT:textBox1:TabIndex = 3. /* */ /* LAbelTicket */ /* */ THIS-OBJECT:LAbelTicket:Location = NEW System.Drawing.Point(881, 30). THIS-OBJECT:LAbelTicket:Name = "LAbelTicket". THIS-OBJECT:LAbelTicket:Size = NEW System.Drawing.Size(100, 23). THIS-OBJECT:LAbelTicket:TabIndex = 4. THIS-OBJECT:LAbelTicket:Text = "Venta". THIS-OBJECT:LAbelTicket:UseCompatibleTextRendering = TRUE. /* */ /* LAvance */ /* */ DEFINE VARIABLE nestedvar1 AS System.Drawing.FontStyle NO-UNDO. nestedvar1 = System.Drawing.FontStyle:Bold. THIS-OBJECT:LAvance:Font = NEW System.Drawing.Font("Microsoft Sans Serif", Progress.Util.CastUtil:ToSingle(12), CAST(Progress.Util.EnumHelper:Or(nestedvar1, System.Drawing.FontStyle:Italic), System.Drawing.FontStyle), System.Drawing.GraphicsUnit:Point, System.Convert:ToByte(0)). THIS-OBJECT:LAvance:Location = NEW System.Drawing.Point(180, 106). THIS-OBJECT:LAvance:Name = "LAvance". THIS-OBJECT:LAvance:Size = NEW System.Drawing.Size(153, 23). THIS-OBJECT:LAvance:TabIndex = 5. THIS-OBJECT:LAvance:Text = "Meta de Ventas". THIS-OBJECT:LAvance:UseCompatibleTextRendering = TRUE. /* */ /* LNumeroTickets */ /* */ THIS-OBJECT:LNumeroTickets:Location = NEW System.Drawing.Point(180, 174). THIS-OBJECT:LNumeroTickets:Name = "LNumeroTickets". THIS-OBJECT:LNumeroTickets:Size = NEW System.Drawing.Size(100, 13). THIS-OBJECT:LNumeroTickets:TabIndex = 6. THIS-OBJECT:LNumeroTickets:Text = "Tickets". THIS-OBJECT:LNumeroTickets:UseCompatibleTextRendering = TRUE. /* */ /* fTickets */ /* */ THIS-OBJECT:fTickets:Location = NEW System.Drawing.Point(180, 190). THIS-OBJECT:fTickets:Name = "fTickets". THIS-OBJECT:fTickets:Size = NEW System.Drawing.Size(93, 20). THIS-OBJECT:fTickets:TabIndex = 7. /* */ /* fNombreEmpleado */ /* */ THIS-OBJECT:fNombreEmpleado:Font = NEW System.Drawing.Font("Microsoft Sans Serif", Progress.Util.CastUtil:ToSingle(15.75), System.Drawing.FontStyle:Bold, System.Drawing.GraphicsUnit:Point, System.Convert:ToByte(0)). THIS-OBJECT:fNombreEmpleado:Location = NEW System.Drawing.Point(279, 30). THIS-OBJECT:fNombreEmpleado:Name = "fNombreEmpleado". THIS-OBJECT:fNombreEmpleado:Size = NEW System.Drawing.Size(370, 46). THIS-OBJECT:fNombreEmpleado:TabIndex = 8. THIS-OBJECT:fNombreEmpleado:Text = "Nombre". THIS-OBJECT:fNombreEmpleado:UseCompatibleTextRendering = TRUE. /* */ /* textKilos */ /* */ THIS-OBJECT:textKilos:Location = NEW System.Drawing.Point(339, 190). THIS-OBJECT:textKilos:Name = "textKilos". THIS-OBJECT:textKilos:Size = NEW System.Drawing.Size(100, 20). THIS-OBJECT:textKilos:TabIndex = 9. /* */ /* LabelKilos */ /* */ THIS-OBJECT:LabelKilos:Location = NEW System.Drawing.Point(339, 174). THIS-OBJECT:LabelKilos:Name = "LabelKilos". THIS-OBJECT:LabelKilos:Size = NEW System.Drawing.Size(100, 13). THIS-OBJECT:LabelKilos:TabIndex = 10. THIS-OBJECT:LabelKilos:Text = "Puntos". THIS-OBJECT:LabelKilos:UseCompatibleTextRendering = TRUE. /* */ /* ven06100 */ /* */ THIS-OBJECT:AcceptButton = THIS-OBJECT:buttonOk. THIS-OBJECT:ClientSize = NEW System.Drawing.Size(1022, 708). THIS-OBJECT:Controls:Add(THIS-OBJECT:LabelKilos). THIS-OBJECT:Controls:Add(THIS-OBJECT:textKilos). THIS-OBJECT:Controls:Add(THIS-OBJECT:fNombreEmpleado). THIS-OBJECT:Controls:Add(THIS-OBJECT:fTickets). THIS-OBJECT:Controls:Add(THIS-OBJECT:LNumeroTickets). THIS-OBJECT:Controls:Add(THIS-OBJECT:LAvance). THIS-OBJECT:Controls:Add(THIS-OBJECT:LAbelTicket). THIS-OBJECT:Controls:Add(THIS-OBJECT:textBox1). THIS-OBJECT:Controls:Add(THIS-OBJECT:progressBar1). THIS-OBJECT:Controls:Add(THIS-OBJECT:buttonOk). THIS-OBJECT:FormBorderStyle = System.Windows.Forms.FormBorderStyle:FixedDialog. THIS-OBJECT:MaximizeBox = FALSE. THIS-OBJECT:MinimizeBox = FALSE. THIS-OBJECT:Name = "ven06100". THIS-OBJECT:ShowInTaskbar = FALSE. THIS-OBJECT:StartPosition = System.Windows.Forms.FormStartPosition:CenterParent. THIS-OBJECT:Text = "ven06100". THIS-OBJECT:ResumeLayout(FALSE). THIS-OBJECT:PerformLayout(). CATCH e AS Progress.Lang.Error: UNDO, THROW e. END CATCH. END METHOD. METHOD PUBLIC VOID ShowModalDialog( ): // WAIT-FOR THIS-OBJECT:ShowDialog(). END METHOD.
today in the morning it was running ok.... but then changed fonts, and _inserted a tlerik RadChartView, showed properties and the deleted it_...
from then on, every attempt to run that window (class) forced a stop with following log trace...
[16/09/19@18:08:42.128-0500] P-052536 T-047760 2 4GL 4GLTRACE Run MuestraAvance "2 0" [USER-INTERFACE-TRIGGER - Procs\Ven\Ven06034.w @ 2671] [16/09/19@18:08:42.129-0500] P-052536 T-047760 1 4GL -- System.InvalidOperationException: No se permite empezar un bucle de segundo mensaje en un subproceso sencillo. Utilice en su lugar Form.ShowDialog. [16/09/19@18:08:42.129-0500] P-052536 T-047760 1 4GL -- ** ABL Debug-Alert Stack Trace ** [16/09/19@18:08:42.129-0500] P-052536 T-047760 1 4GL -- --> MuestraAvance Procs\Ven\Ven06034.w at line 4642 (c:\tap\Procs\Ven\Ven06034.r) [16/09/19@18:08:42.129-0500] P-052536 T-047760 1 4GL -- USER-INTERFACE-TRIGGER Procs\Ven\Ven06034.w at line 2671 (c:\tap\Procs\Ven\Ven06034.r)
(Searched message and it is:
System.InvalidOperationException: Starting a second message loop on a single thread is not valid operation. Use Form.ShowDialog instead.
You cannot WAIT-FOR a Progress built-in event once any .NET forms are made visible. Use WAIT-FOR Application:Run(form) or WAIT-FOR formx:ShowDialog() instead. (13967)
I'm really confused... can anybody see why happened this?
TIA
Jorge Olguin
|
Worked like a charm!!!!!
Just a little question... my main menu is waiting on: System.Windows.Forms.Application:Exit() .
and tested all the subsecuent windows .w that are called form that menu and all seems ok... As that menu calls some 20-30 other windows ( *.w ). I don't have to make other chages didn't ?....
Just an anoying side efect....
The main menu calls a .w, (let's call it processor.w) wich at ine point creates a dinamic frame with a wait message, and then instantiates the oForm class... But just catched an operator staring that message for 5 mins... (after all the message said "Wait"), and I approached and found the form poped below the window process.w...
How would I make the form behave like a good'ol dialog-frame?
Thanks, again...
|
1. I don't understand what you mean by:
--my main menu is waiting on: System.Windows.Forms.Application:Exit() .
You don't wait on Application:Exit. You call Application:Exit when you want to shut down the app.
2. When you say "processor.w wich at ine point creates a dinamic frame with a wait message", what do you mean by a wait message?
3. Is this a .NET class that you want to be a dialog box? If so, you use form:ShowDialog(). If it's an ABL window, you can use a WAIT-FOR just like you used to. There should only ever be one WAIT-FOR for all non-modal windows. Dialogs get their own WAIT-FOR if they are ABL, or ShowDialog() for .NET.
the message I send to user came from this:
.... {procs\inc\wait.i} do something... return. // from procedure. and wait.i being this... DEFINE RECTANGLE RECT3 EDGE-PIXELS 2 GRAPHIC-EDGE NO-FILL SIZE 40.5 BY 1.59. DISPLAY " Wait... " VIEW-AS TEXT SIZE 40 BY 1.35 AT ROW 1.65 COL 8.29 BGCOLOR 10 FONT 6 SPACE(6.42) SKIP(0.84) RECT3 AT ROW 1.55 COL 47.4 RIGHT-ALIGNED WITH FRAME frame-wait VIEW-AS DIALOG-BOX KEEP-TAB-ORDER SIDE-LABELS NO-UNDERLINE THREE-D SCROLLABLE TITLE "Proceso".
And the wait condition, I changed on the main-block of main menu, so it ended like this, as Mike said...:
IF NOT THIS-PROCEDURE:PERSISTENT THEN // WAIT-FOR CLOSE OF THIS-PROCEDURE. WAIT-FOR System.Windows.Forms.Application:Run() . // no form reference.