Page 1 of 2

Mawdraw problem (easyptr4)

Posted: Sat Apr 14, 2018 6:53 am
by Giorgio Garabello
Hi, do you think it is possible to format a single item of an application window menu so that it always appears as a single element but divided into two lines? I tried to insert chr $ (10) inside an element of an arrray like this: a $ (0) = "Hi" & chr $ (10) & "For" but it does not work, only "Hi" is displayed .

Regards
Giorgio

Re: Mawdraw problem (easyptr4)

Posted: Sat Apr 14, 2018 6:55 am
by Giorgio Garabello
Giorgio Garabello wrote:Hi, do you think it is possible to format a single item of an application window menu so that it always appears as a single element but divided into two lines? I tried to insert chr $ (10) inside an element of an arrray like this: a $ (0) = "Hi" & chr $ (10) & "John" but it does not work, only "Hi" is displayed .

Regards
Giorgio

Re: Mawdraw problem (easyptr4)

Posted: Sat Apr 14, 2018 7:12 am
by tofro
Giorgio,

the simplest way to achieve that is to create a bitmap of that two lines of text and put the bitmap in the menu.

There are probably better ways to do that, though.

Tobias

Re: Mawdraw problem (easyptr4)

Posted: Sat Apr 14, 2018 7:30 am
by Giorgio Garabello
tofro wrote:Giorgio,

the simplest way to achieve that is to create a bitmap of that two lines of text and put the bitmap in the menu.

There are probably better ways to do that, though.

Tobias
the problem is that is not a fixed text but came frim a file, it change every time.

Re: Mawdraw problem (easyptr4)

Posted: Sat Apr 14, 2018 8:31 am
by Giorgio Garabello
Giorgio Garabello wrote:Hi, do you think it is possible to format a single item of an application window menu so that it always appears as a single element but divided into two lines? I tried to insert chr $ (10) inside an element of an arrray like this: a $ (0) = "Hi" & chr $ (10) & "John" but it does not work, only "Hi" is displayed .

Regards
Giorgio

Re: Mawdraw problem (easyptr4)

Posted: Sat Apr 14, 2018 9:35 am
by pjw
Giorgio Garabello wrote:Hi, do you think it is possible to format a single item of an application window menu so that it always appears as a single element but divided into two lines? I tried to insert chr $ (10) inside an element of an arrray like this: a $ (0) = "Hi" & chr $ (10) & "For" but it does not work, only "Hi" is displayed .
I havent tried this, but you could try making the element box the size you want (MAWDRAW#ch,,,,,xsz%, ysz%) then, using MWINDOW, print the lines into the box.
Still, the most flexible method, to my mind would be my third suggestion of last night: Once you have your menu window up and running, with a suitable Application window inside, bypass Wman and fake the usual Wman interaction using only PI. To make the routine fast and smoothe, dont bother faking the selection outline, but use highlighting instead. BYpassing Wman constraints in this way opens the door many other interesting effects which are currently impossible under Wman.

Re: Mawdraw problem (easyptr4)

Posted: Sat Apr 14, 2018 5:22 pm
by Giorgio Garabello
I've just tried but seems dont work
MWINDOW #3,65537
Print #3, "hallo" dont print in the furst menu element but in the cirner of the MAW

Re: Mawdraw problem (easyptr4)

Posted: Sun Apr 15, 2018 1:25 pm
by BSJR
Giorgio Garabello wrote:I've just tried but seems dont work
MWINDOW #3,65537
Print #3, "hallo" dont print in the furst menu element but in the cirner of the MAW
Are you sure?
In my test I did the same, the string was nicely printed in each of the 4 menu items when hit:
:
rep loop
num= mcall (#c3%,0): awn= 65536
select on num
= -1 : stop : rem >>> esc
= -3 : mawdraw #c3%\1 : rem >>> wake, restores original aw$
=awn +1 : mwindow #c3%,awn +1: print #c3%;aw$(0,0)
=awn *2 +1 : mwindow #c3%,awn *2 +1: print #c3%;aw$(0,1)
=awn *3 +1 : mwindow #c3%,awn *3 +1: print #c3%;aw$(1,0)
=awn *4 +1 : mwindow #c3%,awn *4 +1: print #c3%;aw$(1,1)
end select
end rep
:
aw$ is the original array for MAWSETUP, containing a LF between two strings.
MAWDRAW and MAWITEM will only show the first part but PRINT will use the LF to move to the next line.
Remember that the y-size of each cell must be enough to hold the lines.
Also any justification used in MAWDRAW will have no effect after MWINDOW and may need to be fixed with AT or CURSOR commands.

You could use a loop to go through all visible aw$ items to check if any LF is there and then do a MWINDOW/PRINT to replace that cell. However depending on the number of visible cells this may be a slow process.
Beware that if the string before the LF is too long for the cell width, the rest will move one line down too.

Bob

Re: Mawdraw problem (easyptr4)

Posted: Sun Apr 15, 2018 1:39 pm
by Giorgio Garabello
BSJR wrote:
Giorgio Garabello wrote:I've just tried but seems dont work
MWINDOW #3,65537
Print #3, "hallo" dont print in the furst menu element but in the cirner of the MAW
Are you sure?
In my test I did the same, the string was nicely printed in each of the 4 menu items when hit:
:
rep loop
num= mcall (#c3%,0): awn= 65536
select on num
= -1 : stop : rem >>> esc
= -3 : mawdraw #c3%\1 : rem >>> wake, restores original aw$
=awn +1 : mwindow #c3%,awn +1: print #c3%;aw$(0,0)
=awn *2 +1 : mwindow #c3%,awn *2 +1: print #c3%;aw$(0,1)
=awn *3 +1 : mwindow #c3%,awn *3 +1: print #c3%;aw$(1,0)
=awn *4 +1 : mwindow #c3%,awn *4 +1: print #c3%;aw$(1,1)
end select
end rep
:
aw$ is the original array for MAWSETUP, containing a LF between two strings.
MAWDRAW and MAWITEM will only show the first part but PRINT will use the LF to move to the next line.
Remember that the y-size of each cell must be enough to hold the lines.
Also any justification used in MAWDRAW will have no effect after MWINDOW and may need to be fixed with AT or CURSOR commands.

You could use a loop to go through all visible aw$ items to check if any LF is there and then do a MWINDOW/PRINT to replace that cell. However depending on the number of visible cells this may be a slow process.
Beware that if the string before the LF is too long for the cell width, the rest will move one line down too.

Bob
I'm trying to do something different, you print the string after clicking, I need to present a list in which each element is divided into several lines, to scroll through this list and eventually select an element

Giorgio

Re: Mawdraw problem (easyptr4)

Posted: Sun Apr 15, 2018 2:14 pm
by BSJR
I'm trying to do something different, you print the string after clicking, I need to present a list in which each element is divided into several lines, to scroll through this list and eventually select an element

Giorgio
This is just a proof of concept. I have not tested what happens when a list needs to scroll up or down.
If it's a single column list you want, you could adopt what I do in SuQcess with Viewing a record with subfields.
The list can be scrolled (set the main window to a minimum) and each line is a field or a subfield and can be clicked on.
In a separate array I keep track of which field that line belongs to so the correct field is taken to act upon.

Bob