|
From: Alexander S.K. <al...@be...> - 2015-05-20 10:55:21
|
Alain Aupeix writes:
> Le 20. 05. 15 11:56, Alain Aupeix a écrit :
>> Hi,
>>
>> I have a main window where I display the content of variables.
>> These variables are memvar and public, and set to ""
>>
>> In a window opened from an icon toolbar, I choose an element in a combobox
>> When choosing it, I display the values of variables corresponding to the
>> current element displayed
>> After validating an element (with ok), and located in an if structure,
>> so I suppose the window is no more active,
>> I change the values of the variables of the main window
>>
>> When I then try to display the new value, I then have a segmentation error.
>>
>> Is-it normal, where do I fail ?
>
> Here is the function which crashes:
>
> //
> ============================================================================
> Function display_main()
> //
> ============================================================================
> qout(trim(aMachines[nPartner,15]))
> @ 180,50 SAY aMachines[nPartner,15] SIZE 100, 20 BACKCOLOR 14473941
> COLOR hwg_VColor("0000FF")
>
> Return Nil
>
It is difficult to make a conclusion when I don't see the full code,
but I suppose that you open a dialog from a main window, then close it
and call that display_main() trying to show something in the main
window. Right ?
If so, you need directly set the parent of the new widget:
@ 180,50 SAY aMachines[nPartner,15] OF oMainWindow ...
Without this HwGUI uses as default parent last created window - the
dialog, which is already closed.
And yet another thing. The better practice is to create that SAT
preliminarily, while the creation of a main window, with an empty
caption, and just a set new value there when it is needed.
Regards, Alexander.
|