Mawdraw problem (easyptr4)

Anything QL Software or Programming Related.
User avatar
Giorgio Garabello
Gold Card
Posts: 277
Joined: Tue Jun 30, 2015 8:39 am
Location: Turin, Italy
Contact:

Mawdraw problem (easyptr4)

Post 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


User avatar
Giorgio Garabello
Gold Card
Posts: 277
Joined: Tue Jun 30, 2015 8:39 am
Location: Turin, Italy
Contact:

Re: Mawdraw problem (easyptr4)

Post 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


User avatar
tofro
Font of All Knowledge
Posts: 2685
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: Mawdraw problem (easyptr4)

Post 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


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
User avatar
Giorgio Garabello
Gold Card
Posts: 277
Joined: Tue Jun 30, 2015 8:39 am
Location: Turin, Italy
Contact:

Re: Mawdraw problem (easyptr4)

Post 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.


User avatar
Giorgio Garabello
Gold Card
Posts: 277
Joined: Tue Jun 30, 2015 8:39 am
Location: Turin, Italy
Contact:

Re: Mawdraw problem (easyptr4)

Post 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


User avatar
pjw
QL Wafer Drive
Posts: 1286
Joined: Fri Jul 11, 2014 8:44 am
Location: Norway
Contact:

Re: Mawdraw problem (easyptr4)

Post 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.


Per
dont be happy. worry
- ?
User avatar
Giorgio Garabello
Gold Card
Posts: 277
Joined: Tue Jun 30, 2015 8:39 am
Location: Turin, Italy
Contact:

Re: Mawdraw problem (easyptr4)

Post 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


User avatar
BSJR
Trump Card
Posts: 182
Joined: Sun Oct 18, 2015 12:53 pm
Location: Amsterdam
Contact:

Re: Mawdraw problem (easyptr4)

Post 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


User avatar
Giorgio Garabello
Gold Card
Posts: 277
Joined: Tue Jun 30, 2015 8:39 am
Location: Turin, Italy
Contact:

Re: Mawdraw problem (easyptr4)

Post 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


User avatar
BSJR
Trump Card
Posts: 182
Joined: Sun Oct 18, 2015 12:53 pm
Location: Amsterdam
Contact:

Re: Mawdraw problem (easyptr4)

Post 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


Post Reply