Page 1 of 1

Merging a child window in a parent window

Posted: Thu Aug 28, 2014 11:37 pm
by obelix
:eusa-hand: Hi everybody
I need your help to dissolve two similar problems:
1. I read from a text file to a database by a fread() operation. The content of the every record should be shown in the window without
building a new window after every record (preventing a flickering window)
2. I want to show the result of a GET cvar VALID {||udfcontent(cvar)} operation in my existing window without rebuilding this window

Code: Select all

#include "dcdialog.ch"

 proc main
   cvar="0"
   cvar2="Content may be changed by udfcontent()"
   GetList := {}
   @ 10,5 DCSAY "Only for demonstration"
   @ 12,5 DCSAY "This is my parent window, which should not disappear during counting to 100 "
   // The next line should be displayed in a child window without hiding the parent window
   for x= 1 to 100
     @ 14,5 DCSAY "Just count to hundred "+ str(x)  // here should  be shown the content of a fread() operation or
                                                     // reading from a database from top to eof()  in a child window like 1,2 ..
   next
   // end of the child window
   //...
   //...
   @ 16,5 DCSAY cvar2

   //  the content of cvar2 should be changed by the function udfcontent and be displayed in the parent window
   @ 18,5 DCSAY "Show me the content of the function" get cvar valid  {||udfcontent(cvar),DC_GetRefresh(GetList)}
   ctitle=""
   DCREAD GUI  FIT ADDBUTTONS
   //
   return

   function udfcontent
   parameters cvar1
   if cvar1="1"
      cvar2="Content changed to 1"
   else
      cvar2="Content changed to 2"
   endif
   @ 16,5 DCSAY cvar2
   return (cvar1)


Re: Merging a child window in a parent window

Posted: Fri Aug 29, 2014 12:00 am
by skiman
Hi,

I don't know what you really want to do, but instead of
@ 16,5 DCSAY cvar2

you should use
@ 16,5 DCSAY {|| cvar2 }

When it is a codeblock, it will be evaluated with a dc_getrefresh().

I would add a button which has an action to get the next line:
{|| x++ , udfcontent(x), dc_getrefresh(getlist) }
Each time you click on the button, the next line would appear.

Re: Merging a child window in a parent window

Posted: Fri Aug 29, 2014 7:53 am
by obelix
Wow I couldn't believe it. It really works! Good advice for my second problem.
Thank you Chris!